diff --git a/cocoviewer.py b/cocoviewer.py index 470a4be..e43215d 100644 --- a/cocoviewer.py +++ b/cocoviewer.py @@ -180,7 +180,10 @@ def draw_bboxes(draw, objects, labels, obj_categories, ignore, width, label_size # TODO: Implement notification message as popup window font = ImageFont.load_default() - tw, th = draw.textsize(text, font) + # Replace deprecated textsize with textbbox + # Get the bounding box of the text + left, top, right, bottom = draw.textbbox((0, 0), text, font=font) + tw, th = right - left, bottom - top tx0 = b[0] ty0 = b[1] - th