When using the following in Python's Pillow:
textsize = 14
font = ImageFont.truetype("Arial Unicode.ttf", size=textsize)
txw, txh = draw.textlength(label, font=font)
The following error occurred.
AttributeError: 'ImageDraw' object has no attribute 'textsize'
The following was helpful as a solution.
Python pillow/PIL doesn't recognize the attribute "textsize" of the object "imagedraw"
I already checked python version on my environment (sublime text) and it is 3.11.0, the latest, I checked pillow version which is 10.0.0, the latest, and my code looks similar to other examples onl...
Specifically, I rewrote it as follows.
textsize = 14
font = ImageFont.truetype("Arial Unicode.ttf", size=textsize)
txw = draw.textlength(label, font=font)
txh = textsize
I hope this is helpful.




Comments
…