Results 1 to 7 of 7

Thread: [RESOLVED] If pixel equals X...help

Hybrid View

  1. #1
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [RESOLVED] If pixel equals X...help

    What's wrong with Color.Black ?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Feb 2007
    Posts
    180

    Re: [RESOLVED] If pixel equals X...help

    Quote Originally Posted by penagate
    What's wrong with Color.Black ?
    Thats what i tried in the beginning. My image had a black background with a single white dot in the middle. I ran... If Bitmap.Getpixel = color.black then end ... and it would just run through without finding anything. I wonder if it is something to do with using a 24bbp image or something. Either way i solved it by using color.fromargb().

  3. #3
    Frenzied Member
    Join Date
    Mar 2005
    Location
    Sector 001
    Posts
    1,577

    Re: [RESOLVED] If pixel equals X...help

    I also had problems directly comparing a known pixel color to predefined color even though their rgb and Argb values were the same.

    For 'normal' and particularly for user defined colors (which are nameless) you can also use the argb value for comparison - it is only one integer instead of 3+1.
    Code:
    '-16777216 is black, -1 is white etc.
    If myBitmap.GetPixel(xx, yy).ToArgb <> Color.Black.ToArgb  Then 
    
        MsgBox(xx & ", " & yy)
                    
    End If
    For your second question try this link.
    VB 2005, Win Xp Pro sp2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width