Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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.
|
| 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 |
|