ExElNeT Posted August 31, 2006 Share Posted August 31, 2006 Hi! I have two colors ... red 5901320 and black 1580056. I test a pixel for those colors with PixelGetColor but sometimes the color differs slighty ... how can decide if its black or red ... ? thanks in advance Link to comment Share on other sites More sharing options...
Valuater Posted August 31, 2006 Share Posted August 31, 2006 PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] )when looking for two colorsjust use it twice....If PixelSearch(red) = "red" or PixelSearch(black) = "black" then....8) Link to comment Share on other sites More sharing options...
ExElNeT Posted August 31, 2006 Author Share Posted August 31, 2006 sorry i didnt really understand your answer ... i know the coordinates of the pixel and i just want to know if its red or black ... light red dark red or light black, dark black i just want to know if its more red or more black thanks Link to comment Share on other sites More sharing options...
Don N Posted August 31, 2006 Share Posted August 31, 2006 Try this, change the pixel coordinates to match the pixel you wish to check. HotKeySet( "{Esc}", "test_pixel" ) $RED = Dec( "FF0000" ) $BLACK = 0 While 1 Sleep( 500 ) WEnd Func test_pixel() $color = PixelGetColor( 300, 160 ) $color = Dec( $color ) $red_diff = Abs( $RED - $color ) $black_diff = $color - $BLACK If $red_diff > $black_diff Then MsgBox( 0, "Color Match", "The pixel color is more black than red." ) ElseIf $black_diff > $red_diff Then MsgBox( 0, "Color Match", "The pixel color is more red than black." ) Else MsgBox( 0, "Color Match", "The pixel color is just as close to black as it is to red." ) EndIf EndFunc Hope that helps, Don _____________________________________________________"some people live for the rules, I live for exceptions"Wallpaper Changer - Easily Change Your Windows Wallpaper Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now