jonathang commited on
Commit
f3eb3cf
1 Parent(s): 95c34a4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -153,7 +153,9 @@ def overlay_text_on_image(img, text, position, text_color=(255, 255, 255), box_c
153
  r = font_size - 1
154
  font_size = max(l-1, 1)
155
 
156
- text_width, text_height = draw.textsize(text, font=font)
 
 
157
 
158
  if position == 'top-left':
159
  x, y = 0, 0
 
153
  r = font_size - 1
154
  font_size = max(l-1, 1)
155
 
156
+ left, upper, right, lower = draw.textbbox((0, 0), text, font=font)
157
+ text_width = right - left
158
+ text_height = lower - upper
159
 
160
  if position == 'top-left':
161
  x, y = 0, 0