This commit is contained in:
Haoming 2026-05-31 23:59:08 +08:00
parent bfa6f820e6
commit 180e6e2309
2 changed files with 5 additions and 3 deletions

View File

@ -110,8 +110,11 @@ def process_batch(p, input, output_dir, inpaint_mask_dir, args, to_scale=False,
info_img_path = os.path.join(png_info_dir, os.path.basename(image))
info_img = images.read(info_img_path)
geninfo, _ = images.read_info_from_image(info_img)
_orig: str = shared.opts.infotext_styles
shared.opts.infotext_styles = "Ignore"
parsed_parameters = parse_generation_parameters(geninfo)
parsed_parameters = {k: v for k, v in parsed_parameters.items() if k in (png_info_props or {})}
shared.opts.infotext_styles = _orig
parsed_parameters = {k: v for k, v in parsed_parameters.items() if k in (png_info_props or [])}
except Exception:
parsed_parameters = {}

View File

@ -544,8 +544,7 @@ def create_ui():
img2img_batch_inpaint_mask_dir = gr.Textbox(label="Inpaint batch mask directory (required for inpaint batch processing only)", **shared.hide_dirs, elem_id="img2img_batch_inpaint_mask_dir")
tab_batch_upload.select(fn=lambda: "upload", outputs=[img2img_batch_source_type])
tab_batch_from_dir.select(fn=lambda: "from dir", outputs=[img2img_batch_source_type])
with gr.Accordion("PNG info", open=False):
img2img_batch_use_png_info = gr.Checkbox(label="Append png info to prompts", elem_id="img2img_batch_use_png_info")
with InputAccordion(False, label="Append PNG Info", elem_id="img2img_batch_use_png_info") as img2img_batch_use_png_info:
img2img_batch_png_info_dir = gr.Textbox(label="PNG info directory", **shared.hide_dirs, placeholder="Leave empty to use input directory", elem_id="img2img_batch_png_info_dir")
img2img_batch_png_info_props = gr.CheckboxGroup(["Prompt", "Negative prompt", "Seed", "CFG scale", "Sampler", "Steps", "Model hash", "Filename"], label="Parameters to take from png info", info="Prompts from png info will be appended to prompts set in ui.")