From bd10f0f6c72d3a0135b72f31b51057eb74c116eb Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 12 Jan 2023 18:01:36 +0100 Subject: [PATCH] Revert PIL deprecation fix Signed-off-by: Glenn Jocher --- utils/plots.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 41a387200..f84aed9fb 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -88,7 +88,8 @@ 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.getbbox(label) # text width, height + w, h = self.font.getsize(label) # text width, height (WARNING: deprecated) in 9.2.0 + # _, _, w, h = self.font.getbbox(label) # text width, height (New) 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,