diff options
author | glop102 <alexlikeschess@gmail.com> | 2023-01-29 00:25:52 +0000 |
---|---|---|
committer | glop102 <alexlikeschess@gmail.com> | 2023-01-29 00:25:52 +0000 |
commit | 09a142a05a6da8bdd4f36678a098c2a573db181a (patch) | |
tree | f733b81f163515e2c7fc1c28250711c733ae12e7 | |
parent | 0a8515085ef258d4b76fdc000f7ed9d55751d6b8 (diff) | |
download | stable-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.
-rw-r--r-- | modules/images.py | 2 |
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)
|