aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGugubo <29143981+Gugubo@users.noreply.github.com>2022-10-14 15:07:24 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-10-14 16:54:24 +0000
commit5f87dd1ee0960963e3f756c4ebe47652ff57f715 (patch)
tree4b5367e19b765f21816cac2af52af7eff04d2568
parent43f926aad1b77a4bb642c1d173adfae1f56cf42d (diff)
downloadstable-diffusion-webui-gfx803-5f87dd1ee0960963e3f756c4ebe47652ff57f715.tar.gz
stable-diffusion-webui-gfx803-5f87dd1ee0960963e3f756c4ebe47652ff57f715.tar.bz2
stable-diffusion-webui-gfx803-5f87dd1ee0960963e3f756c4ebe47652ff57f715.zip
Add option to prevent empty spots in grid (2/2)
-rw-r--r--modules/images.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/images.py b/modules/images.py
index 90eca37a..b9589563 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -24,10 +24,13 @@ def image_grid(imgs, batch_size=1, rows=None):
rows = opts.n_rows
elif opts.n_rows == 0:
rows = batch_size
- else:
+ elif opts.grid_prevent_empty_spots:
rows = math.floor(math.sqrt(len(imgs)))
while len(imgs) % rows != 0:
rows -= 1
+ else:
+ rows = math.sqrt(len(imgs))
+ rows = round(rows)
cols = math.ceil(len(imgs) / rows)