Question

What is the simplest way to pick up the RGB color code of the given coordinates? For simplicity let's assume that the screen resolution is 1024x768 and color depth/quality 32 bits. The coordinates are given relative to the upper left corner of the screen. I'd like to get some tips or examples how it can be done with Python.

Was it helpful?

Solution

The win32gui ActivePython documentation should be useful. I think you can construct something like:

import win32gui
GetPixel(GetDC(WindowFromPoint( (XPos,YPos) )), XPos , YPos )
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top