aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-09-14 10:34:44 +0300
committerAUTOMATIC <16777216c@gmail.com>2022-09-14 10:34:44 +0300
commit6bea45d495710fa30d0b024a9dbceaaee1d02ac6 (patch)
tree8f75c98f1dfe62ca67fa3c43090b5d872f35c5bd
parent21f2a706bb80b00ec0709e677ea94a12bbb5320e (diff)
prevent making grid if there is no need for it #428
-rw-r--r--modules/processing.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/modules/processing.py b/modules/processing.py
index ef25d43d..ca32c610 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -312,16 +312,14 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
state.nextjob()
unwanted_grid_because_of_img_count = len(output_images) < 2 and opts.grid_only_if_multiple
- if not p.do_not_save_grid and not unwanted_grid_because_of_img_count:
- return_grid = opts.return_grid
-
+ if (opts.return_grid or opts.grid_save) and not p.do_not_save_grid and not unwanted_grid_because_of_img_count:
grid = images.image_grid(output_images, p.batch_size)
- if return_grid:
+ if opts.return_grid:
output_images.insert(0, grid)
if opts.grid_save:
- images.save_image(grid, p.outpath_grids, "grid", all_seeds[0], all_prompts[0], opts.grid_format, info=infotext(), short_filename=not opts.grid_extended_filename, grid=True, p=p)
+ images.save_image(grid, p.outpath_grids, "grid", all_seeds[0], all_prompts[0], opts.grid_format, info=infotext(), short_filename=not opts.grid_extended_filename, p=p)
devices.torch_gc()
return Processed(p, output_images, all_seeds[0], infotext())