From 0e24b7e2f584beea3f573ddb82c3b93558daeb1f Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 12 Jan 2023 17:43:12 +0100 Subject: [PATCH] PIL `.get_size()` deprecation fix (#10754) Signed-off-by: Glenn Jocher Signed-off-by: Glenn Jocher --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index d2f232de0..41a387200 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -88,7 +88,7 @@ class Annotator: if self.pil or not is_ascii(label): self.draw.rectangle(box, width=self.lw, outline=color) # box if label: - w, h = self.font.getsize(label) # text width, height + _, _, w, h = self.font.getbbox(label) # text width, height outside = box[1] - h >= 0 # label fits outside box self.draw.rectangle( (box[0], box[1] - h if outside else box[1], box[0] + w + 1,