Created
November 8, 2017 21:25
-
-
Save AlexEshoo/dc95cf5d06d855367ec31d5693c02990 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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