[lug] gimp suggestions?

D. Stimits stimits at comcast.net
Tue Jan 17 22:02:08 MST 2006


Jeremy Hinegardner wrote:
> On Mon, Jan 16, 2006 at 06:19:35PM -0700, D. Stimits wrote:
> 
>>I'm looking for the most direct way to export, from gimp (or some other 
>>common tool), the RGB or RGBA data from a color image as hex data. E.G., 
>>for red => ff0000, green => 00ff00, blue => 0000ff. I'm experimenting 
>>with some of the file formats which come close, but for example the xpm 
>>format seems to do some encoding. Can anyone give me an idea of some 
>>simple way to take an image and save it as just RGB/RGBA pixel data in a 
>>hex string, with no compression or other information?
> 
> 
> Command line ImageMagick with netpbm is some powerful mojo:
> 
>     Strip out the red channel and make it portable greymap in ascii
>     format:
> 
>         convert <image> -fx R pgm:- | pgmtopgm -plain > greyscale_red.pgm
> 
>     Remove the Blue and Green channels from the color image and save it
>     as a portable pix map:
> 
>         convert <image> -channel BG -fx 0 ppm:- | ppmtoppm -plain > red.ppm
> 
> this was gathered from:
> 
>     http://www.cit.gu.edu.au/~anthony/graphics/imagick6/channels/           
> 
> the ppm/pgm ascii format isn't in hex, but it can be easily converted to
> hex if that is what you really need.

Yes, this is very useful...I actually did something prior to this that 
was almost the same, but not nearly as easy (involved writing a C 
program to process pbm files). With convert I can skip the C program part.

D. Stimits, stimits AT comcast DOT net



More information about the LUG mailing list