|
@@ -2,7 +2,7 @@ from sys import stdin
|
|
from textwrap import fill, shorten
|
|
from textwrap import fill, shorten
|
|
|
|
|
|
from ujson import loads
|
|
from ujson import loads
|
|
-from PIL import Image, ImageDraw, ImageFont
|
|
|
|
|
|
+from PIL import Image, ImageDraw, ImageFont, ImageOps
|
|
from emoji import demojize
|
|
from emoji import demojize
|
|
|
|
|
|
COLORS = [
|
|
COLORS = [
|
|
@@ -73,10 +73,6 @@ draw.multiline_text((margin + avatar_width + hpadding, margin + username_height
|
|
|
|
|
|
message.paste(tail, (margin + avatar_width - tail_width + 8, image_height - margin - tail_height + 1), tail)
|
|
message.paste(tail, (margin + avatar_width - tail_width + 8, image_height - margin - tail_height + 1), tail)
|
|
|
|
|
|
-ratio = image_width / image_height
|
|
|
|
-new_width = 512 if image_width >= image_height else min(int(512 / ratio), 512)
|
|
|
|
-new_height = 512 if image_height >= image_width else min(int(512 / ratio), 512)
|
|
|
|
-
|
|
|
|
-message = message.resize((new_width, new_height))
|
|
|
|
|
|
+message = ImageOps.contain(message, (512, 512))
|
|
|
|
|
|
message.save(output_path)
|
|
message.save(output_path)
|