Suppose there is a site on which three rectangles are located. As I can find out the color and make to variables, even through the number (i.e., red – 1, green – 2, yellow – 3)?
Answer 1, Authority 100%
from pil import imagegrab
image = image ()
Class Pixel:
Def __init __ (Self, Position, Color):
Self.position = Position
Self.color = Color.
Class Image:
Def __init __ (Self):
self.image_obj = imagegrab.grab (BBOX = (0, 0, 100, 100)) # do screenshot
self.pixels = self.image.load () # take all pixels
DEF Get_Pixel (Self, X, Y):
RETURN PIXEL ((X, Y), Self.pixels [x, y])
For example:
print (1, 1) .color)
will return color, conditionally, “255, 255, 255”