Closed RexMan04 closed 3 years ago
You are getting image not found every time ? Are you sure github.png displayed on your screen is not resized ? The lib matches the exact image so if it's scaled down or up it won't find it
I would recommend using Python 3.7.9 for this package. Pyautogui sill has some issues with newer versions. Install opencv and pyautogui before installing python-imagesearch.
Pyautogui will only check in main monitor.
Please leave the window format same as screenshot. If you resize it pyautogui won't be able to locate it. Use only .png Remember to save .png in the same folder with your test script.
If you have one display use time.sleep to have some time to minimize stuff and leave the testimage open as it is.
import time from python_imagesearch.imagesearch import imagesearch
pos = imagesearch("test.png")
time.sleep(2) if pos[0] != -1: print("Found") else: print("Not Found")
thanks, it worked once I used python 3.7.9 and made sure that it was the same size
using this exact code with the image on screen and it just returns image not found. Any help would be appreciated. I have tried on all my screens and with only one plugged in but it isn't working.
from python_imagesearch.imagesearch import imagesearch
pos = imagesearch("./github.png") if pos[0] != -1: print("position : ", pos[0], pos[1]) else: print("image not found")