aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-01-29 06:29:23 +0000
committerGitHub <noreply@github.com>2023-01-29 06:29:23 +0000
commit1d24665229bcef3de1e517f0db3ce296749d8a98 (patch)
treef733b81f163515e2c7fc1c28250711c733ae12e7
parent0a8515085ef258d4b76fdc000f7ed9d55751d6b8 (diff)
parent09a142a05a6da8bdd4f36678a098c2a573db181a (diff)
downloadstable-diffusion-webui-gfx803-1d24665229bcef3de1e517f0db3ce296749d8a98.tar.gz
stable-diffusion-webui-gfx803-1d24665229bcef3de1e517f0db3ce296749d8a98.tar.bz2
stable-diffusion-webui-gfx803-1d24665229bcef3de1e517f0db3ce296749d8a98.zip
Merge pull request #7344 from glop102/master
Reduce grid rows if larger than number of images available
-rw-r--r--modules/images.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/images.py b/modules/images.py
index 0bc3d524..ae3cdaf4 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -36,6 +36,8 @@ def image_grid(imgs, batch_size=1, rows=None):
else:
rows = math.sqrt(len(imgs))
rows = round(rows)
+ if rows > len(imgs):
+ rows = len(imgs)
cols = math.ceil(len(imgs) / rows)