python-imagesearch icon indicating copy to clipboard operation
python-imagesearch copied to clipboard

'ScreenShot' object has no attribute 'thumbnail'

Open OlegSmoliakov opened this issue 2 years ago • 0 comments

I use MacBook with Retina display, so when I ran the simple code below:

from python_imagesearch import imagesearch

img = "pics/testimg.png"
print(imagesearch.imagesearch(img))

I got this error:

.venv/lib/python3.11/site-packages/python_imagesearch/imagesearch.py", line 124, in imagesearch 
im.thumbnail((round(im.size[0] * 0.5), round(im.size[1] * 0.5)))
^^^^^^^^^^^^
AttributeError: 'ScreenShot' object has no attribute 'thumbnail'

It looks like conditions with the is_retina variable doesn't work properly, because if I comment these lines:

If platform.system() == "Darwin":
    is_retina = subprocess.call("system_profiler SPDisplaysDataType | grep -i 'retina'", shell=True) == 0

The code will execute without errors, but I'm not sure that trick won't break anything. 🤔

OlegSmoliakov avatar Oct 03 '23 09:10 OlegSmoliakov