On 7/22/07, Paul Newton <[EMAIL PROTECTED]> wrote: > Hi all > > I would like to be able to get a list of the colors used in an image. I > can use GDIPlusX to create the image from file but not sure what to do > next. The image will not necessarily be a GIF (for which I have an > example), so I can't use the image palette and in any event, images > don't necessarily use all the colors in their associated palette (I think ?)
Of course. > I am thinking that perhaps I could iterate/scan through the image and > check the color of each pixel in the image ? But I can't see a means of > getting a pixel/point from the xfcImage .... But this might be slow, so > I would prefer a more direct approach if there is one. I'm not overly familiar with GDIPlus programming. 2 problems come to mind: - The fastest method would be to get at the pixel data directly but this in itself is tricky as this could be in a number of different formats. e.g. 1-8bit (palette based), 15/16 bit (555, 565, etc), 24 bit, 32 bit (24bit with alpha channel). And these are just the easy ones! - How are you going to count colours? If you're dealing with a 24 bit image you can't use the 'tally table' method because your table would be too big (4billion x integer size). P.S. write the code in C :-) -- Paul _______________________________________________ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.