coco-viewer icon indicating copy to clipboard operation
coco-viewer copied to clipboard

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

Open BingliangLi opened this issue 8 months ago • 1 comments
trafficstars

BingliangLi avatar Feb 25 '25 12:02 BingliangLi

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]

mostcat avatar Apr 29 '25 06:04 mostcat