python - Is it possible to get the color of a particular pixel on the screen with it's X and Y coordinates? -
i color of particular pixel in python using x y coordinates, possible?
this in windows, if makes difference.
see http://rosettacode.org/wiki/color_of_a_screen_pixel under heading python
they give:
def get_pixel_colour(i_x, i_y): import win32gui i_desktop_window_id = win32gui.getdesktopwindow() i_desktop_window_dc = win32gui.getwindowdc(i_desktop_window_id) long_colour = win32gui.getpixel(i_desktop_window_dc, i_x, i_y) i_colour = int(long_colour) return (i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff) print get_pixel_colour(0, 0)
which uses python extensions windows available python 2.3 3.1 @ http://sourceforge.net/projects/pywin32/files/pywin32/build%20214/
Comments
Post a Comment