Skip to content

Fix AttributeError: 'ImageDraw' object has no attribute 'textsize' #78

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

BingliangLi
Copy link

No description provided.

@mostcat
Copy link

mostcat commented Apr 29, 2025

The ImageDraw object does not have a textsize attribute. This is because in Pillow version 10.0.0, the textsize method has been deprecated, and it is recommended to use textlength and textbbox instead.

                bbox = draw.textbbox((0, 0), text, font=font)
                tw = bbox[2] - bbox[0]
                th = bbox[3] - bbox[1]

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

Successfully merging this pull request may close these issues.

2 participants