Skip to content

Commit

Permalink
Update Pillow to >=10.0.0 and update get_text_height api
Browse files Browse the repository at this point in the history
  • Loading branch information
lizhq authored Feb 15, 2024
1 parent 1120fe8 commit 42ebabf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements-hw.txt
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
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
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
Expand Down
3 changes: 2 additions & 1 deletion trdg/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ def get_text_height(image_font: ImageFont, text: str) -> int:
"""
Get the height 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

0 comments on commit 42ebabf

Please sign in to comment.