Color of a screen pixel: Difference between revisions

Content added Content deleted
m (→‎{{header|Python}}: avoid deprecation warning in get_image(x, y, width, height, format, plane_mask))
Line 76: Line 76:
import Xlib.display # python-xlib
import Xlib.display # python-xlib
o_x_root = Xlib.display.Display().screen().root
o_x_root = Xlib.display.Display().screen().root
o_x_image = o_x_root.get_image(i_x, i_y, 1, 1, Xlib.X.ZPixmap, -1)
o_x_image = o_x_root.get_image(i_x, i_y, 1, 1, Xlib.X.ZPixmap, 0xffffffff)
o_pil_image_rgb = PIL.Image.fromstring("RGB", (1, 1), o_x_image.data, "raw", "BGRX")
o_pil_image_rgb = PIL.Image.fromstring("RGB", (1, 1), o_x_image.data, "raw", "BGRX")
lf_colour = PIL.ImageStat.Stat(o_pil_image_rgb).mean
lf_colour = PIL.ImageStat.Stat(o_pil_image_rgb).mean