mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
PIL .get_size()
deprecation fix (#10754)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
cdd804d39f
commit
0e24b7e2f5
@ -88,7 +88,7 @@ class Annotator:
|
|||||||
if self.pil or not is_ascii(label):
|
if self.pil or not is_ascii(label):
|
||||||
self.draw.rectangle(box, width=self.lw, outline=color) # box
|
self.draw.rectangle(box, width=self.lw, outline=color) # box
|
||||||
if label:
|
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
|
outside = box[1] - h >= 0 # label fits outside box
|
||||||
self.draw.rectangle(
|
self.draw.rectangle(
|
||||||
(box[0], box[1] - h if outside else box[1], box[0] + w + 1,
|
(box[0], box[1] - h if outside else box[1], box[0] + w + 1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user