✨
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user