Jump to content
Sign in to follow this  

Check Pixel Change with Tolerance

Recommended Posts


So I have a script that uses PixelSearch to check 1 pixel and see if it has changed past a certain tolerance. However, this method is slow and unreliable, and I was wondering if there is somehow a way to check 1 pixel (with tolerance) to see if it has changed. Maybe like PixelCheckSum but with a tolerance parameter.

Share this post

Link to post
Share on other sites

Something like this should work for you.

#Include <Color.au3>

$iTestColour = 0xAB1200
$iTolerance = 10
$var = PixelGetColor( 10 , 100 )
If (Abs(_ColorGetRed($var) - _ColorGetRed($iTestColour)) <=  $iTolerance) _ 
    And (Abs(_ColorGetBlue($var) - _ColorGetBlue($iTestColour)) <=  $iTolerance) _
    And (Abs(_ColorGetGreen($var) - _ColorGetGreen($iTestColour)) <=  $iTolerance) Then
    MsgBox(0,"The colour matches", Hex($var,6))
    MsgBox(0,"The colour does not match", Hex($var,6))
Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.