From 67a32bd0540a4bd28e5a31faccbb2e8a20a4d3f3 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 2 Aug 2023 10:54:36 +0530 Subject: [PATCH] fix: Set minimum resolution of image --- frappe/utils/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frappe/utils/image.py b/frappe/utils/image.py index 60ae09e0b4..eb57fbe0a7 100644 --- a/frappe/utils/image.py +++ b/frappe/utils/image.py @@ -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)