mirror of
https://github.com/brycedrennan/imaginAIry
synced 2024-11-05 12:00:15 +00:00
fix: use better rescale
This commit is contained in:
parent
b69b4c770e
commit
30a80faf47
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user