Skip to content
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' #70

Closed
paynepang opened this issue Mar 27, 2024 · 5 comments
Closed

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #70

paynepang opened this issue Mar 27, 2024 · 5 comments
Labels
suggestion Suggestion

Comments

@paynepang
Copy link

查看一下pillow的版本:10.0.0

通过在pillow官方网站,release notes中找到了问题:
image
原来是在pillow的10.0.0版本中,ANTIALIAS方法被删除了,改为10.0版本许可的参数即可。

解决办法:(推荐方案二)

方案一,修改ddddocr的_init_.py文件,将其中的ANTIALIAS替换为新方法:

image = image.resize((int(image.size[0] * (64 / image.size[1])), 64), Image.ANTIALIAS).convert('L')

image = image.resize((int(image.size[0] * (64 / image.size[1])), 64), Image.LANCZOS).convert('L')

方案二,降级Pillow的版本,比如使用9.5.0版本

先卸载,再重新安装

pip uninstall -y Pillowpip install Pillow==9.5.0
两种方案都亲测可用

@StoneBang
Copy link

同样遇到了这种问题

@wangwenqiao666
Copy link

pip install Pillow==9.5.0

两个方法都没用的,我都试过了

@wangwenqiao666
Copy link

pip install Pillow==9.5.0

两个方法都没用的,我都试过了

我重新更新了下代码好了

@harry0703 harry0703 added the suggestion Suggestion label Mar 27, 2024
@chaorders1
Copy link

感谢! 解决了问题

@Timoshao
Copy link

我直接升级到10.2.0解决了
pip install --upgrade pillow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion Suggestion
Projects
None yet
Development

No branches or pull requests

6 participants