aboutsummaryrefslogtreecommitdiffstats
path: root/webui.py
diff options
context:
space:
mode:
authorAUTOMATIC <16777216c@gmail.com>2022-08-28 18:11:58 +0000
committerAUTOMATIC <16777216c@gmail.com>2022-08-28 18:11:58 +0000
commit7a7a3a6b194578097b054ac0e58e15b2142ac106 (patch)
tree73c7da7849ccf12edffac9bca8f50ca51afa1812 /webui.py
parent6bec9c3a4f277cff7d4ff8f811808543e295345d (diff)
downloadstable-diffusion-webui-gfx803-7a7a3a6b194578097b054ac0e58e15b2142ac106.tar.gz
stable-diffusion-webui-gfx803-7a7a3a6b194578097b054ac0e58e15b2142ac106.tar.bz2
stable-diffusion-webui-gfx803-7a7a3a6b194578097b054ac0e58e15b2142ac106.zip
Option to not save grid for single images for #22
Diffstat (limited to 'webui.py')
-rw-r--r--webui.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/webui.py b/webui.py
index 77ff0469..0e4fb399 100644
--- a/webui.py
+++ b/webui.py
@@ -131,6 +131,7 @@ class Options:
"grid_save": OptionInfo(True, "Save image grids"),
"grid_format": OptionInfo('png', 'File format for grids'),
"grid_extended_filename": OptionInfo(False, "Add extended info (seed, prompt) to filename when saving grid"),
+ "grid_only_if_multiple": OptionInfo(True, "Do not save grids consisting of one picture"),
"n_rows": OptionInfo(-1, "Grid row count; use -1 for autodetect and 0 for it to be same as batch size", gr.Slider, {"minimum": -1, "maximum": 16, "step": 1}),
"jpeg_quality": OptionInfo(80, "Quality for saved jpeg images", gr.Slider, {"minimum": 1, "maximum": 100, "step": 1}),
"export_for_4chan": OptionInfo(True, "If PNG image is larger than 4MB or any dimension is larger than 4000, downscale and save copy as JPG"),
@@ -876,7 +877,8 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
output_images.append(image)
base_count += 1
- if (p.prompt_matrix or opts.grid_save) and not p.do_not_save_grid:
+ unwanted_grid_because_of_img_count = len(output_images) < 2 and opts.grid_only_if_multiple
+ if (p.prompt_matrix or opts.grid_save) and not p.do_not_save_grid and not unwanted_grid_because_of_img_count:
if p.prompt_matrix:
grid = image_grid(output_images, p.batch_size, rows=1 << ((len(prompt_matrix_parts)-1)//2))