generated from OpenTimelineIO/otio-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
Breaks with error:
# # box_size = ifont.getsize(text)
# # AttributeError: 'FreeTypeFont' object has no attribute 'getsize'
The getsize
method was deprecated and removed in newer versions of Pillow. It was replaced by textbbox() or getbbox().
Solution could be:
try:
box_size = ifont.getsize(text)
except AttributeError:
# Fallback for newer Pillow versions
# Get the bounding box relative to the anchor point (0,0)
left, top, right, bottom = ifont.getbbox(text)
box_size = (right - left, bottom - top)
Metadata
Metadata
Assignees
Labels
No labels