aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-09-30 09:59:21 +0300
committerGitHub <noreply@github.com>2023-09-30 09:59:21 +0300
commit591ad1dbc38aa7e160ab1c34226dc9269b35983c (patch)
tree4e3a363af8b53bc805d60364a67990b0e873dd85
parentfcfe5c179b56abb3d43783dd1b7bd6689d2320ad (diff)
parentab5741717546758c57cf6c2a040645ec2b44690a (diff)
Merge pull request #13170 from AUTOMATIC1111/re-fix-batch-img2img-output-dir-with-script
Re fix batch img2img output dir with script
-rw-r--r--modules/img2img.py2
-rw-r--r--modules/processing.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/modules/img2img.py b/modules/img2img.py
index 7ca10cf0..52cb577a 100644
--- a/modules/img2img.py
+++ b/modules/img2img.py
@@ -117,6 +117,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args, to_scale=Fal
if output_dir:
p.outpath_samples = output_dir
p.override_settings['save_to_dirs'] = False
+ p.override_settings['save_images_replace_action'] = "Add number suffix"
if p.n_iter > 1 or p.batch_size > 1:
p.override_settings['samples_filename_pattern'] = f'{image_path.stem}-[generation_number]'
else:
@@ -125,6 +126,7 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args, to_scale=Fal
proc = modules.scripts.scripts_img2img.run(p, *args)
if proc is None:
+ p.override_settings.pop('save_images_replace_action', None)
process_images(p)
diff --git a/modules/processing.py b/modules/processing.py
index 0c191428..618f8abe 100644
--- a/modules/processing.py
+++ b/modules/processing.py
@@ -711,7 +711,7 @@ def process_images(p: StableDiffusionProcessing) -> Processed:
if p.scripts is not None:
p.scripts.before_process(p)
- stored_opts = {k: opts.data[k] for k in p.override_settings.keys()}
+ stored_opts = {k: opts.data[k] for k in p.override_settings.keys() if k in opts.data}
try:
# if no checkpoint override or the override checkpoint can't be found, remove override entry and load opts checkpoint