fix: Set minimum resolution of image

This commit is contained in:
Suraj Shetty 2023-08-02 10:54:36 +05:30
parent 672835d7a9
commit 67a32bd054

View file

@ -53,8 +53,8 @@ def optimize_image(
image = Image.open(io.BytesIO(content))
width, height = image.size
max_height = min(max_height, height * 0.8)
max_width = min(max_width, width * 0.8)
max_height = max(min(max_height, height * 0.8), 200)
max_width = max(min(max_width, width * 0.8), 200)
image_format = content_type.split("/")[1]
size = max_width, max_height
image.thumbnail(size, Image.Resampling.LANCZOS)