I'm comparing two screenshots to determine if a kiosk is frozen.
So both images will have the exactly the same size and structure which makes it an apples to apples comparison.
I'm just wondering if there is a faster method of comparison, or if there's an interesting pythonic method of achieving this goal.
So both images will have the exactly the same size and structure which makes it an apples to apples comparison.
I'm just wondering if there is a faster method of comparison, or if there's an interesting pythonic method of achieving this goal.
import pyautogui from PIL import Image from time import sleep pyautogui.screenshot('current_screen.png') img_a_pixels = Image.open('current_screen.png').getdata() #sleep(60) #Used in practice pyautogui.screenshot('current_screen.png') img_b_pixels = Image.open('current_screen.png').getdata() difference = 0 for pixel_a, pixel_b in zip(img_a_pixels, img_b_pixels): if pixel_a != pixel_b: difference += 1 print(difference)This returns an int telling how many pixels are different, an allowance of a few hundred has to be allotted for the clock, mouse, and blinking cursor.