From f71a3c9c3a8f6d9e5a6231f9f94900201da3e554 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Mon, 20 Feb 2023 17:30:13 +0900 Subject: [PATCH] convert resolution to int using round() --- modules/images.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/images.py b/modules/images.py index 38404de3dc1..5b80c23e11e 100644 --- a/modules/images.py +++ b/modules/images.py @@ -582,9 +582,9 @@ def _atomically_save_image(image_to_save, filename_without_extension, extension) ratio = image.width / image.height if oversize and ratio > 1: - image = image.resize((opts.target_side_length, image.height * opts.target_side_length // image.width), LANCZOS) + image = image.resize((round(opts.target_side_length), round(image.height * opts.target_side_length / image.width)), LANCZOS) elif oversize: - image = image.resize((image.width * opts.target_side_length // image.height, opts.target_side_length), LANCZOS) + image = image.resize((round(image.width * opts.target_side_length / image.height), round(opts.target_side_length)), LANCZOS) try: _atomically_save_image(image, fullfn_without_extension, ".jpg")