VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Count Colors In Pic (Final update 15 June 06)

CptnVic  (6 Submissions)   Graphics   Intermediate   Wed 3rd February 2021

Update 15 June 2006: (Thanks to Robert Rayment and Cobein for ideas/code!) This final (as far as I'm concerned) version now uses the GetDIBits API color stream to count the unique colors in a picture Very Quickly.
Tested in XP and Me... Not 95/98/NT yet (but should work). Masking colors returned in the GetDIBits array should resolve the OS problems that would otherwise occur.
In XP tests, three of these functions will counts a 1024x768 pic with 145,350 colors in +-.125 seconds and the 4th in +- .203 seconds... and that's not bad (Tests were compiled)!
This version includes 4 different functions for quickly counting unique colors. 2 are my work and 2 are modified from Rayment's code.

Inputs
A picture for the picture box

Assumes
Moderators: (I see the screen shot was missing... This upload just to replace the screen shot)

Returns
Unique colors in said picture

API Declarations
GetDIBits
GetTickCount

Rate Count Colors In Pic (Final update 15 June 06) (3(3 Vote))

Download Count Colors In Pic (Final update 15 June 06)

Count Colors In Pic (Final update 15 June 06) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters