Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@miau
Created July 8, 2011 16:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miau/1072207 to your computer and use it in GitHub Desktop.
Save miau/1072207 to your computer and use it in GitHub Desktop.
import ImageGrab
import itertools
import time
while True:
im = ImageGrab.grab()
print max([len(list(g)) for k, g in itertools.groupby(im.getdata()) if k == (255, 0, 0)])
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment