aboutsummaryrefslogtreecommitdiffstats
path: root/modules/images.py
diff options
context:
space:
mode:
authorglop102 <alexlikeschess@gmail.com>2023-01-29 00:25:52 +0000
committerglop102 <alexlikeschess@gmail.com>2023-01-29 00:25:52 +0000
commit09a142a05a6da8bdd4f36678a098c2a573db181a (patch)
treef733b81f163515e2c7fc1c28250711c733ae12e7 /modules/images.py
parent0a8515085ef258d4b76fdc000f7ed9d55751d6b8 (diff)
downloadstable-diffusion-webui-gfx803-09a142a05a6da8bdd4f36678a098c2a573db181a.tar.gz
stable-diffusion-webui-gfx803-09a142a05a6da8bdd4f36678a098c2a573db181a.tar.bz2
stable-diffusion-webui-gfx803-09a142a05a6da8bdd4f36678a098c2a573db181a.zip
Reduce grid rows if larger than number of images available
When a set number of grid rows is specified in settings, then it leads to situations where an entire row in the grid is empty. The most noticable example is the processing preview when the row count is set to 2, where it shows the preview just fine but with a black rectangle under it.
Diffstat (limited to 'modules/images.py')
-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)