diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-12-24 06:07:00 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 06:07:00 +0000 |
commit | 55f3ef876be02ebec40ca91f9232a269ac6703e3 (patch) | |
tree | 320987d7b642452a1d7f7835423aaadd7085f19a | |
parent | 992a877a4af357a945e0c7f49b67c4537f128f38 (diff) | |
parent | 6fd91c9179f51dd2f73f03eeabd12bfd081941c5 (diff) | |
download | stable-diffusion-webui-gfx803-55f3ef876be02ebec40ca91f9232a269ac6703e3.tar.gz stable-diffusion-webui-gfx803-55f3ef876be02ebec40ca91f9232a269ac6703e3.tar.bz2 stable-diffusion-webui-gfx803-55f3ef876be02ebec40ca91f9232a269ac6703e3.zip |
Merge pull request #5814 from timntorres/5802-save-upscaler-to-filename
Add option to save upscaler to filename suffix in extras tab.
-rw-r--r-- | modules/extras.py | 8 | ||||
-rw-r--r-- | modules/shared.py | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/modules/extras.py b/modules/extras.py index 0ad8deec..704e5165 100644 --- a/modules/extras.py +++ b/modules/extras.py @@ -193,8 +193,14 @@ def run_extras(extras_mode, resize_mode, image, image_folder, input_dir, output_ else:
basename = ''
+ # Add upscaler name as a suffix.
+ suffix = f"-{shared.sd_upscalers[extras_upscaler_1].name}" if shared.opts.use_upscaler_name_as_suffix else ""
+ # Add second upscaler if applicable.
+ if suffix and extras_upscaler_2 and extras_upscaler_2_visibility:
+ suffix += f"-{shared.sd_upscalers[extras_upscaler_2].name}"
+
images.save_image(image, path=outpath, basename=basename, seed=None, prompt=None, extension=opts.samples_format, info=info, short_filename=True,
- no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=existing_pnginfo, forced_filename=None)
+ no_prompt=True, grid=False, pnginfo_section_name="extras", existing_info=existing_pnginfo, forced_filename=None, suffix=suffix)
if opts.enable_pnginfo:
image.info = existing_pnginfo
diff --git a/modules/shared.py b/modules/shared.py index 272267c1..215c1358 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -293,6 +293,7 @@ options_templates.update(options_section(('saving-images', "Saving images/grids" "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"),
"use_original_name_batch": OptionInfo(False, "Use original name for output filename during batch process in extras tab"),
+ "use_upscaler_name_as_suffix": OptionInfo(False, "Use upscaler name as filename suffix in the extras tab"),
"save_selected_only": OptionInfo(True, "When using 'Save' button, only save a single selected image"),
"do_not_add_watermark": OptionInfo(False, "Do not add watermark to images"),
|