Feb-08-2021, 03:29 PM
img = pyautogui.locateOnScreen('test.png',confidence=0.8,region=(280,284,261,228))
I think... (280,284,261,228) represents (x, y, height, width) of the image you want. So if you use the x,y of your mouse position in there the image location will be the mouse location.
eg:
(your_mouse.x - 50, your_mouse.y - 50, 100, 100)
will give you a 100x100 square centered on the mouse.