Revert PIL deprecation fix

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/10660/head^2
Glenn Jocher 2023-01-12 18:01:36 +01:00 committed by GitHub
parent 0e24b7e2f5
commit bd10f0f6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -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,