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.
This commit is contained in:
parent
0a8515085e
commit
09a142a05a
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user