-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #1077
Comments
Some update: downgrading Pillow to 9.5.0 fixes this issue, but I think it will be a good idea to also change the ANTIALIAS parameter in the easyocr\utils.py too. |
I met the same error just now, now i ll try your method |
It works,very thanks |
Same issue. Can you please provide how to change the ANTIALIAS parameter in the easyocr\utils.py |
I think, it's easier for you to just reinstall the PIL package. Try running this in the console/terminal: |
This works thanks I've got the issue right now but it would be great to make it compatible with newer versions. |
Thank You |
It works for me. Thanks |
PIL fails on RTD due to AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' . Based on JaidedAI/EasyOCR#1077 let us try to add pillow with <=9.5.0 . Pillow is not part of RTD from aug 2023 os good to add it here anyway
Update .readthedocs.yml Update .readthedocs.yml Update .readthedocs.yml Update .readthedocs.yml Update .readthedocs.yml add pillow <=9.5.0 PIL fails on RTD due to AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' . Based on JaidedAI/EasyOCR#1077 let us try to add pillow with <=9.5.0 . Pillow is not part of RTD from aug 2023 os good to add it here anyway Update requirements.txt Update .readthedocs.yml Update requirements.txt
|
Use PILOW==9.5.0 as workaround. That worked for me. |
Thankyou. Currently using Pillow 10.0.0. Then downgrade. It's work. |
you just saved my life thank you |
Having the same issue. I'll give the PIL older version a try. I agree that easyocr should be adjusted for newer PIL versions. Or at least give people a heads up at installation documentation. |
This issue is fixed in the master branch. |
Back installing worked for me. As well as installing from the the git master as archywillh mentioned worked for me as well. Thank you archywillhe for that info by the way. Additional question. If you don't mind me asking so I can better assist myself in the future, where did you find the info that the master branch had a fix for this? |
working with me,thanks you |
I've had this problem for a long time, thanks for your help |
When forced to find another solution, this also worked for me:
Insert before the call to easyocr's readtext() (or other) method. |
Much better than downgrading PIL. Thank you! |
Heroic thanks! |
Thanks ! you saved my day |
Its a good idea!!! |
Hey @patrickmappedin, but i am getting error like Illegal instruction |
its work thanks |
When I try to use easyocr on any image, I get this error:
AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
According to (https://stackoverflow.com/questions/76616042/attributeerror-module-pil-image-has-no-attribute-antialias), new version of PIL (10.0.0) has no ANTIALIAS, as it's deprecated.
Full error:
File "...", line 8, in convert_img_to_text
result = reader.readtext(img_path)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\venv\Lib\site-packages\easyocr\easyocr.py", line 464, in readtext
result = self.recognize(img_cv_grey, horizontal_list, free_list,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\venv\Lib\site-packages\easyocr\easyocr.py", line 383, in recognize
image_list, max_width = get_image_list(h_list, f_list, img_cv_grey, model_height = imgH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\venv\Lib\site-packages\easyocr\utils.py", line 613, in get_image_list
crop_img,ratio = compute_ratio_and_resize(crop_img,width,height,model_height)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\venv\Lib\site-packages\easyocr\utils.py", line 576, in compute_ratio_and_resize
img = cv2.resize(img,(int(model_height*ratio),model_height),interpolation=Image.ANTIALIAS)
The text was updated successfully, but these errors were encountered: