Skip to content

Instantly share code, notes, and snippets.

@DanBrink91
Created December 17, 2017 00:40
Show Gist options
  • Save DanBrink91/087203b90d9e6552631857afd1be3599 to your computer and use it in GitHub Desktop.
Save DanBrink91/087203b90d9e6552631857afd1be3599 to your computer and use it in GitHub Desktop.
record image of main monitor
from PIL import ImageGrab
import time
# Windows resolution size query
import ctypes
user32 = ctypes.windll.user32
screensize = user32.GetSystemMetrics(0), user32.GetSystemMetrics(1)
i = 0
while True:
i += 1
img = ImageGrab.grab(bbox=(0, 0, screensize[0], screensize[1]))
img.save("whatever%d.jpg" % i, "JPEG")
time.sleep(1)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment