Spaces:
Build error
Build error
FridaKahlosArtCenter
commited on
Commit
·
eb29344
1
Parent(s):
25d0591
fixed textlength
Browse files
app.py
CHANGED
@@ -94,7 +94,7 @@ def image_to_template(generated_image, logo, button_text, punchline, theme_color
|
|
94 |
# Punchline text
|
95 |
text_heights = []
|
96 |
for line in punchline:
|
97 |
-
text_width, text_height = draw.
|
98 |
punchline_pos = (
|
99 |
(template_width - text_width) // 2,
|
100 |
image_pos[1] + generated_image.height + margin + sum(text_heights),
|
@@ -103,7 +103,7 @@ def image_to_template(generated_image, logo, button_text, punchline, theme_color
|
|
103 |
text_heights.append(text_height)
|
104 |
|
105 |
# Button with rounded corners
|
106 |
-
button_text_width, button_text_height = draw.
|
107 |
button_shape = [
|
108 |
((template_width - button_width) // 2, punchline_pos[1] + text_height + margin),
|
109 |
(
|
|
|
94 |
# Punchline text
|
95 |
text_heights = []
|
96 |
for line in punchline:
|
97 |
+
text_width, text_height = draw.textlength(line, font=punchline_font)
|
98 |
punchline_pos = (
|
99 |
(template_width - text_width) // 2,
|
100 |
image_pos[1] + generated_image.height + margin + sum(text_heights),
|
|
|
103 |
text_heights.append(text_height)
|
104 |
|
105 |
# Button with rounded corners
|
106 |
+
button_text_width, button_text_height = draw.textlength(button_text, font=button_font)
|
107 |
button_shape = [
|
108 |
((template_width - button_width) // 2, punchline_pos[1] + text_height + margin),
|
109 |
(
|