@ -15,7 +15,7 @@ def pillow_fit_image_within(image: PIL.Image.Image, max_height=512, max_width=51
resize_ratio = min(max_width / w, max_height / h)
w, h = int(w * resize_ratio), int(h * resize_ratio)
w, h = map(lambda x: x - x % 64, (w, h)) # resize to integer multiple of 64
image = image.resize((w, h), resample=Image.Resampling.NEAREST)
image = image.resize((w, h), resample=Image.Resampling.LANCZOS)
return image