[lug] gimp suggestions?

Jeremy Hinegardner jeremy at hinegardner.org
Tue Jan 17 10:53:24 MST 2006


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.

enjoy,

-jeremy

-- 
========================================================================
 Jeremy Hinegardner                              jeremy at hinegardner.org 




More information about the LUG mailing list