lewis-crawler/Software/houston/RobotStreamer.py

17 lines
330 B
Python

from Xlib import display, X
from PIL import Image
# 580
W,H = 580,620
x,y = 0, 0
dsp = display.Display(':0')
try:
root = dsp.screen().root
raw = root.get_image(x, y, W,H, X.ZPixmap, 0xffffffff)
image = Image.frombytes("RGB", (W-x, H-y), raw.data, "raw", "BGRX")
image.save('image.png')
finally:
dsp.close()