Skip to content

Commit

Permalink
[BugFix] Update pillow usage (#16269)
Browse files Browse the repository at this point in the history
[BugFix] Update textsize usage
  • Loading branch information
y-fjmt authored Jan 2, 2024
1 parent 8b2cff8 commit c157ca1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/tvm/relay/testing/yolo_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,12 @@ def _get_label(font_path, labelstr, rgb):
from PIL import ImageFont

text = labelstr
textSize = 25
colorText = "black"
testDraw = ImageDraw.Draw(Image.new("RGB", (1, 1)))
font = ImageFont.truetype(font_path, 25)
width, height = testDraw.textsize(labelstr, font=font)
font = ImageFont.truetype(font_path, textSize)
width = int(testDraw.textlength(labelstr, font=font))
height = textSize + 5
img = Image.new(
"RGB", (width, height), color=(int(rgb[0] * 255), int(rgb[1] * 255), int(rgb[2] * 255))
)
Expand Down

0 comments on commit c157ca1

Please sign in to comment.