PIL .get_size() deprecation fix (#302)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Glenn Jocher
2023-01-12 17:43:25 +01:00
committed by GitHub
parent c42e44a021
commit 6e9645a603
7 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, GPL-3.0 license
__version__ = "8.0.4"
__version__ = "8.0.5"
from ultralytics.hub import checks
from ultralytics.yolo.engine.model import YOLO

View File

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