-2

You can check the RGB of any pixel on your screen with r,g,b = pyautogui.pixel(x, y) totalling 29 bytes.

However, it uses pyscreeze and it's broken, it's been acknowledged it's broken, confirmed it's fixed and yet is still broken and the author isn't/hasn't replied in months.

Some of these solutions run into hundreds of lines of code. While this isn't really an issue, there must be something similarly as easy as the broken pyautogui method.

How do I check the RGB of a pixel in the least number of bytes?

Note; I don't want to load a picture. I want to get the r,g,b of any single pixel on my screen in real-time.

mak47
  • 246
  • 10
  • 1
    What operating system are you using? What do you mean by **29 bytes**? How are you measuring that? And why does it matter? Edit the question. – Peter Wood May 10 '22 at 10:53
  • @PeterWood I think it means that the code is 29 bytes (i.e. characters in this case) long, as in code golf. – LeopardShark May 10 '22 at 11:01
  • By screen, do you mean displayed by any other application, not just an image file? – mx0 May 10 '22 at 11:01
  • This isn't a duplicate question. The "already answered" question does not work. If whoever had closed it had checked it you'll see it relies on the same method that is broken. – mak47 May 10 '22 at 11:46
  • @PeterWood Same as code golf, 29 characters. It matters because as I detailed, some of the given answers are hundreds of lines of code long which is highly inefficient and in some cases will require code rewrites. I wanted to know the quickest way of getting a value that currently actually works. – mak47 May 10 '22 at 11:48
  • @mak47 the accepted answer uses `ImageGrab` from `PIL` (or [Pillow](https://pillow.readthedocs.io/en/stable/reference/ImageGrab.html)) – Peter Wood May 10 '22 at 15:39

0 Answers0