Skip to content

Commit c81b52f

Browse files
committed
add override settings component to img2img
1 parent 847ceae commit c81b52f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

modules/img2img.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from PIL import Image, ImageOps, ImageFilter, ImageEnhance, ImageChops
88

99
from modules import devices, sd_samplers
10+
from modules.generation_parameters_copypaste import create_override_settings_dict
1011
from modules.processing import Processed, StableDiffusionProcessingImg2Img, process_images
1112
from modules.shared import opts, state
1213
import modules.shared as shared
@@ -75,7 +76,9 @@ def process_batch(p, input_dir, output_dir, inpaint_mask_dir, args):
7576
processed_image.save(os.path.join(output_dir, filename))
7677

7778

78-
def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, steps: int, sampler_index: int, mask_blur: int, mask_alpha: float, inpainting_fill: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, *args):
79+
def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_styles, init_img, sketch, init_img_with_mask, inpaint_color_sketch, inpaint_color_sketch_orig, init_img_inpaint, init_mask_inpaint, steps: int, sampler_index: int, mask_blur: int, mask_alpha: float, inpainting_fill: int, restore_faces: bool, tiling: bool, n_iter: int, batch_size: int, cfg_scale: float, denoising_strength: float, seed: int, subseed: int, subseed_strength: float, seed_resize_from_h: int, seed_resize_from_w: int, seed_enable_extras: bool, height: int, width: int, resize_mode: int, inpaint_full_res: bool, inpaint_full_res_padding: int, inpainting_mask_invert: int, img2img_batch_input_dir: str, img2img_batch_output_dir: str, img2img_batch_inpaint_mask_dir: str, override_settings_texts, *args):
80+
override_settings = create_override_settings_dict(override_settings_texts)
81+
7982
is_batch = mode == 5
8083

8184
if mode == 0: # img2img
@@ -142,6 +145,7 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
142145
inpaint_full_res=inpaint_full_res,
143146
inpaint_full_res_padding=inpaint_full_res_padding,
144147
inpainting_mask_invert=inpainting_mask_invert,
148+
override_settings=override_settings,
145149
)
146150

147151
p.scripts = modules.scripts.scripts_txt2img

modules/ui.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,8 @@ def select_img2img_tab(tab):
872872
inpainting_mask_invert,
873873
img2img_batch_input_dir,
874874
img2img_batch_output_dir,
875-
img2img_batch_inpaint_mask_dir
875+
img2img_batch_inpaint_mask_dir,
876+
override_settings,
876877
] + custom_inputs,
877878
outputs=[
878879
img2img_gallery,
@@ -961,7 +962,7 @@ def select_img2img_tab(tab):
961962
parameters_copypaste.add_paste_fields("img2img", init_img, img2img_paste_fields)
962963
parameters_copypaste.add_paste_fields("inpaint", init_img_with_mask, img2img_paste_fields)
963964
parameters_copypaste.register_paste_params_button(parameters_copypaste.ParamBinding(
964-
paste_button=img2img_paste, tabname="img2img", source_text_component=img2img_prompt, source_image_component=None,
965+
paste_button=img2img_paste, tabname="img2img", source_text_component=img2img_prompt, source_image_component=None, override_settings_component=override_settings,
965966
))
966967

967968
modules.scripts.scripts_current = None

0 commit comments

Comments
 (0)