Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inpaint arguments in .txt file #14497

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions modules/img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
if mask:
p.extra_generation_params["Mask blur"] = mask_blur

if inpainting_mask_invert is not None:
p.extra_generation_params["Mask mode"] = inpainting_mask_invert

if inpainting_fill is not None:
p.extra_generation_params["Masked content"] = inpainting_fill

if inpaint_full_res is not None:
p.extra_generation_params["Inpaint area"] = inpaint_full_res

if inpaint_full_res_padding is not None:
p.extra_generation_params["Only masked padding, pixels"] = inpaint_full_res_padding

with closing(p):
if is_batch:
assert not shared.cmd_opts.hide_ui_dir_config, "Launched with --hide-ui-dir-config, batch img2img disabled"
Expand Down
4 changes: 4 additions & 0 deletions modules/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,10 @@ def select_img2img_tab(tab):
(toprow.ui_styles.dropdown, lambda d: d["Styles array"] if isinstance(d.get("Styles array"), list) else gr.update()),
(denoising_strength, "Denoising strength"),
(mask_blur, "Mask blur"),
(inpainting_mask_invert, 'Mask mode'),
(inpainting_fill, 'Masked content'),
(inpaint_full_res, 'Inpaint area'),
(inpaint_full_res_padding, 'Only masked padding, pixels'),
*scripts.scripts_img2img.infotext_fields
]
parameters_copypaste.add_paste_fields("img2img", init_img, img2img_paste_fields, override_settings)
Expand Down