aboutsummaryrefslogtreecommitdiffstats
path: root/modules/images.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/images.py')
-rw-r--r--modules/images.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/images.py b/modules/images.py
index 68cdbc93..90eca37a 100644
--- a/modules/images.py
+++ b/modules/images.py
@@ -25,8 +25,9 @@ def image_grid(imgs, batch_size=1, rows=None):
elif opts.n_rows == 0:
rows = batch_size
else:
- rows = math.sqrt(len(imgs))
- rows = round(rows)
+ rows = math.floor(math.sqrt(len(imgs)))
+ while len(imgs) % rows != 0:
+ rows -= 1
cols = math.ceil(len(imgs) / rows)