Colors of a picture

Colors of a picture

Post by Eusebi » Fri, 23 May 2003 01:13:48



Is there a way to calculate the % of certain colors of a
picture without:

for i=picture.width
for j=picture.height
case point(i,j)=red
red=red+1
next
next

The picture is a 24 bit Bitmap ...

Please help !!!

Thanks in advance,
Eusebio.

 
 
 

Colors of a picture

Post by Mike D Sutto » Fri, 23 May 2003 01:40:18


Quote:> Is there a way to calculate the % of certain colors of a
> picture without:
<snip>
> The picture is a 24 bit Bitmap ...

There are no API call's that will do this for you, but you can speed up the
process by extracting the image's data with GetDIBits() and just parsing a
byte array (Or for speed you may want to extract to a 32-bit array of longs,
GetDIBits() will perform the colour conversion for you and you can just
check the values directly against vbRed.)
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -

WWW: Http://www.mvps.org/EDais/

 
 
 

Colors of a picture

Post by Eusebi » Fri, 23 May 2003 01:55:42


Thanks again Mike for your help

I forgot to tell you something ... My image is a "clean"
one and, after I paint it with .circle I don't save the
new image (matter of space) but only coordinates, radius
and color of the circle in a text file ...

Eusebio.

Quote:>-----Original Message-----
>> Is there a way to calculate the % of certain colors of a
>> picture without:
><snip>
>> The picture is a 24 bit Bitmap ...

>There are no API call's that will do this for you, but

you can speed up the
Quote:>process by extracting the image's data with GetDIBits()
and just parsing a
>byte array (Or for speed you may want to extract to a 32-

bit array of longs,
>GetDIBits() will perform the colour conversion for you
and you can just
>check the values directly against vbRed.)
>Hope this helps,

>    Mike

> - Microsoft Visual Basic MVP -

>WWW: Http://www.mvps.org/EDais/

>.

 
 
 

Colors of a picture

Post by Mike D Sutto » Fri, 23 May 2003 03:30:44


Quote:> I forgot to tell you something ... My image is a "clean"
> one and, after I paint it with .circle I don't save the
> new image (matter of space) but only coordinates, radius
> and color of the circle in a text file ...

If you're saving the image as vectors then you could get a pretty good
estimate by just using algebra, the radius of a circle is expressed as: Pi *
(R^2)
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -

WWW: Http://www.mvps.org/EDais/

 
 
 

1. Text colored with a picture?

: I'd like to make a line of text not be in a color, but have a graphic as
: its color.

: Kind of like those old postcards that show the name of the city with a
: picture inside of the letters.

How about pasting the picture into the selected text in Photoshop...

___________________

2. Looking for free (costwise) CAD Tool for the Mac?

3. Adjust color scale of picture .PSD

4. One of my textures is missing?

5. transparent color in bmp picture ???

6. ImageCELs SPECIAL OFFER!

7. How can I change colors in a picture ?

8. Hatched Brush background colour

9. Color from one picture to another ?

10. How to unify colors from 2 pictures?

11. ** HELP *** Reducing Colors in a Picture.

12. HELP ! - background color shows thru pictures

13. Change Color in a Picture Control