Skip to content

Instantly share code, notes, and snippets.

@AlexEshoo
Created November 8, 2017 21:25
Show Gist options
  • Save AlexEshoo/dc95cf5d06d855367ec31d5693c02990 to your computer and use it in GitHub Desktop.
Save AlexEshoo/dc95cf5d06d855367ec31d5693c02990 to your computer and use it in GitHub Desktop.
from PIL import Image, ImageGrab
import time
import datetime
prev = datetime.datetime.now()
while True:
#im.show()
im = ImageGrab.grab()
colors = im.getcolors(95570)#16777216) #max number of colors in 24bit color depth
max_occurence, most_present = 0, 0
print(len(colors))
for c in colors:
if c[0] > max_occurence:
(max_occurence, most_present) = c
print(max_occurence, most_present)
now = datetime.datetime.now()
print(now - prev)
prev = now
#time.sleep(0.03333)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment