Image.ANTIALIAS->Image.LANCZOS

This commit is contained in:
j 2023-08-24 23:39:54 +02:00
commit cbaeffde68
10 changed files with 26 additions and 25 deletions

View file

@ -62,11 +62,11 @@ def render_poster(data, poster):
frame_image = Image.open(frame)
frame_image_ratio = frame_image.size[0] / frame_image.size[1]
if frame_ratio < frame_image_ratio:
frame_image = frame_image.resize((int(frame_height * frame_image_ratio), frame_height), Image.ANTIALIAS)
frame_image = frame_image.resize((int(frame_height * frame_image_ratio), frame_height), Image.LANCZOS)
left = int((frame_image.size[0] - frame_width) / 2)
frame_image = frame_image.crop((left, 0, left + frame_width, frame_height))
else:
frame_image = frame_image.resize((frame_width, int(frame_width / frame_image_ratio)), Image.ANTIALIAS)
frame_image = frame_image.resize((frame_width, int(frame_width / frame_image_ratio)), Image.LANCZOS)
top = int((frame_image.size[1] - frame_height) / 2)
frame_image = frame_image.crop((0, top, frame_width, top + frame_height))
poster_image.paste(frame_image, (0, 0))
@ -76,7 +76,7 @@ def render_poster(data, poster):
timeline_height = 64
if timeline:
timeline_image = Image.open(timeline)
timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.ANTIALIAS)
timeline_image = timeline_image.resize((timeline_width, timeline_height), Image.LANCZOS)
poster_image.paste(timeline_image, (0, frame_height))
# text
@ -115,7 +115,7 @@ def render_poster(data, poster):
logo_height = 32
logo_image = Image.open(os.path.join(static_root, '..', '..', 'static', 'png', 'logo.png'))
logo_width = int(round(logo_height * logo_image.size[0] / logo_image.size[1]))
logo_image = logo_image.resize((logo_width, logo_height), Image.ANTIALIAS)
logo_image = logo_image.resize((logo_width, logo_height), Image.LANCZOS)
logo_left = text_width - text_margin - logo_width
logo_top = text_bottom - text_margin - logo_height
for y in range(logo_height):