From 56a0175cc290bdf9328e7d73369a111719f68588 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Tue, 12 Dec 2023 11:26:44 +0800 Subject: [PATCH] fix: move the img save out of loop Signed-off-by: Frost Ming --- hy_tg.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hy_tg.py b/hy_tg.py index e2b96dc..e4a2e58 100644 --- a/hy_tg.py +++ b/hy_tg.py @@ -70,9 +70,7 @@ def compress_image(input_path, output_path, target_size): (int(width * factor), int(height * factor)), PIL.Image.Resampling.LANCZOS, ) - if sizeof_image(img) <= target_bytes: - img.save(output_path, format="JPEG", quality=quality) - return + img.save(output_path, format="JPEG", quality=quality) def draw_pretty_map(location, file_name, style):