Merge pull request #7344 from glop102/master

Reduce grid rows if larger than number of images available
This commit is contained in:
AUTOMATIC1111 2023-01-29 09:29:23 +03:00 committed by GitHub
commit 1d24665229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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)