I'm trying to get the pixel color from the screen at the coordinates x = 386, y = 1131 from the top left hand corner of the screen.
When I run
import PIL.ImageGrab
from time import sleep
sleep(2)
rgb2 = PIL.ImageGrab.grab().load()[386,1131]
couleur = list(rgb2)
del couleur[3]
couleur = '#%02x%02x%02x' % tuple(couleur)
print(couleur)
in python it gives me #2f3136
which is definitely a wrong color.
It should be #fb8908
like this script in AppleScript gives me :
delay 2
set colour to ""
set colour to do shell script "screencapture -R386,1131,1,1 -t bmp $TMPDIR/test.bmp &&
xxd -p -l 3 -s 54 $TMPDIR/test.bmp |
sed 's/\\(..\\)\\(..\\)\\(..\\)/\\3\\2\\1/'"
display dialog colour
I also tried to invert the x and y in the Python version but it still gives me another color than orange. What am I doing wrong ?