-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
替换Pillow为最新版 #10386
替换Pillow为最新版 #10386
Conversation
解决多次识别pdf,受第一次页面最大数量影响的bug
## 替换Pillow为最新版 主要是更新FreeTypeFont.getsize 为 getbbox
## 替换Pillow为最新版 主要是更新FreeTypeFont.getsize 为 getbbox
## 替换Pillow为最新版 主要是更新FreeTypeFont.getsize 为 getbbox
## 替换Pillow为最新版 主要是更新FreeTypeFont.getsize 为 getbbox
Thanks for your contribution! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- getsize替换逻辑不太正确。
- 需要去除ppocr 的requirements中对于pillow版本的依赖。
- 同步提交PR到dygraph分支。
- 另外下面的两行也可以替换一下:
ppocr/data/imaug/rec_img_aug.py L403: Image.ANTIALIAS-> Image.LANCZOS
tools/infer/predict_rec.py L403: Image.ANTIALIAS-> Image.LANCZOS
refer: https://pillow.readthedocs.io/en/stable/releasenotes/2.7.0.html#antialias-renamed-to-lanczos
@@ -23,7 +23,7 @@ def load_fonts(self, fonts_config): | |||
|
|||
def get_valid_height(self, font_path): | |||
font = ImageFont.truetype(font_path, self.height - 4) | |||
_, font_height = font.getsize(self.char_list) | |||
_ , _ , _ , font_height = font.getbbox(self.char_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previous:
width, height = font.getsize("Hello world")
Now:
left, top, right, bottom = font.getbbox("Hello world")
width, height = right - left, bottom - top
refer:
https://pillow.readthedocs.io/en/stable/releasenotes/9.2.0.html#font-size-and-offset-methods
#10344
替换Pillow为最新版
主要是更新FreeTypeFont.getsize 为 getbbox