coco-viewer
coco-viewer copied to clipboard
Fix AttributeError: 'ImageDraw' object has no attribute 'textsize'
trafficstars
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]