Page 1 of 1

How to convert color dump to image?

Posted: 2019-02-11T07:52:30-07:00
by coloring
Given:

Code: Select all

convert rose: txt: > color_dump.txt
How can I convert color_dump.txt or any other text-editable list of colors and coordinates back to an image file?

The goal is to be able to manually correct a few pixels from images with millions of colors, in vim without opening an image editor, so XBM, XPM, and PBM will probably not cut it.

Re: How to convert color dump to image?

Posted: 2019-02-11T08:34:53-07:00
by snibgo
The text file is an image file, readable by IM. Writing it directly is probably faster than using the ">" redirection.

Code: Select all

convert rose: r.txt

convert r.txt r.png

Re: How to convert color dump to image?

Posted: 2019-02-11T09:40:56-07:00
by coloring
Thanks. Can IM accept other text input formats such as csv, or must the text file's formatting match the dump format exactly?

Re: How to convert color dump to image?

Posted: 2019-02-11T09:58:55-07:00
by snibgo
When reading "txt:" format, the hash # character starts a comment to the end of the line. Except for that, the format isn't flexible.

Other text formats are available, eg

Code: Select all

magick rose: -compress None x.pnm
IM has no facility to read generic CSV files. It doesn't know what columns have what meanings. But if you create a CSV file, a script to convert that to a format IM can read should be easy.