This commit is contained in:
2024-05-24 10:09:50 +02:00
parent cfe3d3f329
commit c390a3eb9a
8 changed files with 68 additions and 23 deletions

View File

@ -15,7 +15,7 @@ def gen_image(font: ImageFont.ImageFont) -> str:
text_list = []
line = ""
for word in text.split(" "):
if drawer.textsize(line + word, font)[0] > text_width:
if drawer.textlength(line + word, font) > text_width:
text_list.append(line)
line = ""
else:
@ -36,7 +36,7 @@ def gen_image(font: ImageFont.ImageFont) -> str:
path = f"static/images/{filename}.png"
new_size = (IMAGE_SIZE[0] // 2, IMAGE_SIZE[1] // 2)
img = img.resize(new_size, resample=Image.ANTIALIAS)
img = img.resize(new_size)
img.save(path)
return filename