TIMBOVILL commited on
Commit
8eef721
·
verified ·
1 Parent(s): 9949ff6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -19,7 +19,7 @@ def create_text_clip(text, fontsize, color, size):
19
  draw = ImageDraw.Draw(img)
20
  font_path = "arial.ttf" # Make sure this file is in the root directory of your space
21
  font = ImageFont.truetype(font_path, fontsize)
22
- w, h = draw.textsize(text, font=font)
23
  draw.text(((size[0] - w) / 2, (size[1] - h) / 2), text, font=font, fill=color)
24
  return np.array(img)
25
 
 
19
  draw = ImageDraw.Draw(img)
20
  font_path = "arial.ttf" # Make sure this file is in the root directory of your space
21
  font = ImageFont.truetype(font_path, fontsize)
22
+ w, h = draw.textbbox((0, 0), text, font=font)[2:]
23
  draw.text(((size[0] - w) / 2, (size[1] - h) / 2), text, font=font, fill=color)
24
  return np.array(img)
25