find the pixel closest to black

sickellsell

New member
Joined
Oct 24, 2006
Messages
1
Programming Experience
1-3
Ok, I need to find the pixel closest to black in the picture....So Ive been trying something like

PHP:
dim cpicture as bitmap

            For y = 10 To cpicture.Height - 15 Step 4
                For x = 10 To ocrpicture.Width - 15 Step 4
                    If colors.black - cpicture.GetPixel(x, y) < 350 Then
                        WORKED()
                        Exit Do
                    End If
                Next x
            Next y
        Loop

But it doesnt work...Something about cant convert to long.

If anyone can find a better way to do this or a working way to do this I would love them.

Thanks
 
The color closest to Black is the one with Brightness closest to 0, regardless of values of Hue and Saturation. This information is available from theColor.GetBrightness method.
 
Back
Top