How to convert color dump to image?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
coloring
Posts: 74
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

How to convert color dump to image?

Post by coloring » 2019-02-11T07:52:30-07:00

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.

snibgo
Posts: 11591
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to convert color dump to image?

Post by snibgo » 2019-02-11T08:34:53-07:00

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
snibgo's IM pages: im.snibgo.com

coloring
Posts: 74
Joined: 2015-08-27T10:17:36-07:00
Authentication code: 1151

Re: How to convert color dump to image?

Post by coloring » 2019-02-11T09:40:56-07:00

Thanks. Can IM accept other text input formats such as csv, or must the text file's formatting match the dump format exactly?

snibgo
Posts: 11591
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to convert color dump to image?

Post by snibgo » 2019-02-11T09:58:55-07:00

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.
snibgo's IM pages: im.snibgo.com

Post Reply