Unverified 提交 0e24b7e2 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

PIL `.get_size()` deprecation fix (#10754)

上级 cdd804d3
...@@ -88,7 +88,7 @@ class Annotator: ...@@ -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,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论