asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.45k stars 1.26k forks source link

Detects whether multiple images are included at once #769

Open sokomin opened 1 year ago

sokomin commented 1 year ago

If you want to search for the inclusion of one of several images for a single image, you would write a program like the following.

image_paths= ['img01.png', 'img02.png', 'img03.png', 'img04.png', 'img05.png', 'img06.png', 'img07.png', 'img08.png', 'img09.png', 'img10.png']

for image_path in image_paths:
    image_center = pyautogui.locateCenterOnScreen(image_path)
    if image_center:
         result = True
         break

Is it possible to implement pyautogui.locateCenterOnScreen to speed up the process by determining multiple images at once in a single call? It is okay if True is returned if any of the objects are included.