asweigart / pyscreeze

PyScreeze is a simple, cross-platform screenshot module for Python 2 and 3.
BSD 3-Clause "New" or "Revised" License
194 stars 96 forks source link

hat if you want to find the coordinates of the specified picture from the specified picture? #54

Closed XDSwang closed 4 years ago

deepio commented 4 years ago

Then use the locate function from the documentation:

locate(needleImage, haystackImage, grayscale=False)

Returns (left, top, width, height) coordinate of first found instance of needleImage in haystackImage. Returns None if not found on the screen.

XDSwang commented 4 years ago

@deepio I used it and then QQ图片20200510073905

deepio commented 4 years ago

Maybe this is lost in translation? That error says the small image you're looking for is in fact bigger than the large image that's supposed to contain it. Check your image dimensions again.

XDSwang commented 4 years ago

@deepio Sorry, it suddenly occurred to me that the first one in the front is the little picture, and the second one is the big picture.It was successful

deepio commented 4 years ago

@XDSwang problem solved, you can close the issue now. Or @asweigart you can probably close this issue too.