Malcolm

Malcolm Greene wrote:
> Paul,
>
> Your approach seems reasonable. If performance becomes an issue, I
> think(?) you may find it faster to parse the BMP image as a text file
> vs. use the GDI (or GDIPluse) API's to retrieve individual pixel color
> values.
>
> Curious why you're interested in the number of unique colors in a
> picture?
It all started with a thematic mapping app and color schemes for legends 
- and I got a bit sidetracked !  I had started off with some color 
schemes which I had grabbed off-screen, one color at a time, and saved 
in a table.  I then used GDIPlus to create some color swatches (small 
rectangular bitmaps containing a row of squares each in a different 
color belonging to the scheme).  I then used these swatches in a 
drop-down list to enable selection of the schemes.  Very sweet - worked 
beautifully, but ...

Then I got side-tracked.  I thought why don't I grab a screen (or part 
of a screen - maybe a map legend, or maybe the map itself) and then use 
VFP to get the colors from that "capture" into my table of color 
schemes.  All of this is really for my own amusement - a way of keeping 
mentally active, if you like.  I don't think it's going to go anywhere, 
because ....

A strange thing came to light yesterday regarding the number of colors 
in the images.  One of my schemes has 13 colors and I had created a 
swatch for it with 13 colored squares, black borders and a white 
background.  I then saved this swatch in various formats - BMP, GIF, 
JPG, PNG, TIF (all of this done with GDI).  I expected these images to 
contain 15 colors (13+B+W) but to my surprise when I opened them in 
PaintShop the GIF had 34 colors, the BMP, PNG and TIF had 40 colors, and 
the JPG reports 2342 colors !

BTW these are the same numbers I am getting from the code I posted, 
which is comforting but VERY strange - I think I may go back to grabbing 
the colors one at a time by hand !

Paul Newton



_______________________________________________
Post Messages to: [email protected]
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.

Reply via email to