From: jeljer te Wies Date: 2009-03-23T07:11:07+09:00 Subject: Re: convert PNG to hex Phlip wrote: > jeljer te Wies wrote: > >> I have a question ... I have to convert a png to hex (#FFFFFF). >> I searched now for over 2 hours but can't find anything that works (like >> png library or RMagick). > > Are you asking how to convert the PNG file to one of its colors? > > Use ImageMagick (or GraphicsMagick, via the command line, or MiniMagick, > or > RMagick) to convert the PNG file to the most dirt-simple raster format > possible, > such as YUV. Then read the first few bytes in each bit-plane, in that > format's > encoding, and hash them together. > > There are also get-pixel commands in RMagick... yes I want to convert it to one of its colors ... but the image has only two different colors (black or white) .. It is not really about the colors but I want to know what each pixel has for color (so black or white) ... -- Posted via http://www.ruby-forum.com/.