From de5a8c5cb4000408522e80c9917b71ce3228b616 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Tue, 23 Jan 2024 22:19:38 +0300 Subject: add an option to not overlay original image for inpainting for #14727 --- modules/processing.py | 8 +++++++- modules/shared_options.py | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/processing.py b/modules/processing.py index 72d8093b..52f00bfb 100644 --- a/modules/processing.py +++ b/modules/processing.py @@ -1005,7 +1005,13 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed: image = pp.image mask_for_overlay = getattr(p, "mask_for_overlay", None) - overlay_image = p.overlay_images[i] if getattr(p, "overlay_images", None) is not None and i < len(p.overlay_images) else None + + if not shared.opts.overlay_inpaint: + overlay_image = None + elif getattr(p, "overlay_images", None) is not None and i < len(p.overlay_images): + overlay_image = p.overlay_images[i] + else: + overlay_image = None if p.scripts is not None: ppmo = scripts.PostProcessMaskOverlayArgs(i, mask_for_overlay, overlay_image) diff --git a/modules/shared_options.py b/modules/shared_options.py index ec5cb026..fef1fb83 100644 --- a/modules/shared_options.py +++ b/modules/shared_options.py @@ -201,6 +201,7 @@ options_templates.update(options_section(('img2img', "img2img", "sd"), { "return_mask": OptionInfo(False, "For inpainting, include the greyscale mask in results for web"), "return_mask_composite": OptionInfo(False, "For inpainting, include masked composite in results for web"), "img2img_batch_show_results_limit": OptionInfo(32, "Show the first N batch img2img results in UI", gr.Slider, {"minimum": -1, "maximum": 1000, "step": 1}).info('0: disable, -1: show all images. Too many images can cause lag'), + "overlay_inpaint": OptionInfo(True, "Overlay original for inpaint").info("when inpainting, overlay the original image over the areas that weren't inpainted."), })) options_templates.update(options_section(('optimizations', "Optimizations", "sd"), { -- cgit v1.2.3