-
Notifications
You must be signed in to change notification settings - Fork 999
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
update Pillow to >=10.0.0 and update get_text_height api #323
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pillow>=7.0.0 | ||
Pillow>=10.0.0 | ||
numpy>=1.16.4,<1.17 | ||
requests>=2.20.0 | ||
opencv-python>=4.2.0.32 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pillow>=7.0.0 | ||
Pillow>=10.0.0 | ||
requests>=2.20.0 | ||
opencv-python>=4.2.0.32 | ||
tqdm>=4.23.0 | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -145,4 +145,5 @@ def get_text_height(image_font: ImageFont, text: str) -> int: | |||||||||
""" | ||||||||||
Get the width of a string when rendered with a given font | ||||||||||
""" | ||||||||||
return image_font.getsize(text)[1] | ||||||||||
left, top, right, bottom = image_font.getbbox(text) | ||||||||||
return bottom - top | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my local testing with Pillow v10.2, this produces different results than before. Comparing the output of
So counter-intuitively, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a working version of the fix at robertknight@5abfc4f. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, yes, you are right. Here is a similar fix. The official Pillow documentation suggests the fix with
Comment on lines
+148
to
+149
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Test results with original code:
Test result with the original pull request (
Test result with the fix suggested by @robertknight (
|
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.
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.
This is an unrelated fix of a copy+paste documentation bug.
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.
Pull request #334 fixes this comment.