← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #203302]: Comparing RGB Colours

 

Question #203302 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/203302

    Status: Open => Answered

RaiMan proposed the following answer:
If you want to compare a pixel color this way using the AWT Robot, you
should stay on the Color level:

import java.awt.Robot as JR
import java.awt.Color as JC
rob = JR()
col = rob.getPixelColor(some.x, some.y) # some is some Location()
comp = JC(228, 55, 50)
print redc == comp

But be aware, that this feature is very slow and only acceptable to
check a few pixels.

In your case it might be easier to create small targets (e.g. 4x4 Pixels
as the corner of the selected area) and search it with something like:

region_left_corner.nearby(3).right(300)

where the nearby(3) creates some extra padding area around.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.