Use grayscale matching for faster location
masterYou can pass grayscale=True to any locate function. This desaturates the images and screenshots, which can provide a speedup of approximately 30%. However, this may increase the risk of false-positive matches.
import pyautogui
# Faster matching using grayscale
location = pyautogui.locateOnScreen('calc7key.png', grayscale=True)