From 65995a2ea38a1a0afd06cb508a4f65fd0d3a1743 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sun, 19 Feb 2023 18:31:07 +0300 Subject: [PATCH 1/2] possible fix for #7804 --- scripts/xyz_grid.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/xyz_grid.py b/scripts/xyz_grid.py index 4afcbbfd0..53511b121 100644 --- a/scripts/xyz_grid.py +++ b/scripts/xyz_grid.py @@ -244,6 +244,9 @@ def draw_xyz_grid(p, xs, ys, zs, x_labels, y_labels, z_labels, cell, draw_legend cell_mode = processed_image.mode cell_size = processed_image.size processed_result.images = [Image.new(cell_mode, cell_size)] + processed_result.all_prompts = [processed.prompt] + processed_result.all_seeds = [processed.seed] + processed_result.infotexts = [processed.infotexts[0]] image_cache[index(ix, iy, iz)] = processed_image if include_lone_images: 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 2/2] 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 38404de3d..5b80c23e1 100644 --- a/modules/images.py +++ b/modules/images.py @@ -582,9 +582,9 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i 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")