def i2i_inpaint_call(
    images=[],
    resize_mode=0,
    denoising_strength=0.75,
    image_cfg_scale=1.5,
    mask_image=None,  # PIL Image mask
    mask_blur=8,
    inpainting_fill=0,
    inpaint_full_res=True,
    inpaint_full_res_padding=0,
    inpainting_mask_invert=0,
    initial_noise_multiplier=1,
    prompt="",
    styles=[],
    seed=-1,
    subseed=-1,
    subseed_strength=0,
    seed_resize_from_h=0,
    seed_resize_from_w=0,
    batch_size=1,
    n_iter=1,
    steps=None,
    cfg_scale=7.0,
    width=640,
    height=768,
    restore_faces=False,
    tiling=False,
    do_not_save_samples=False,
    do_not_save_grid=False,
    negative_prompt="",
    eta=1.0,
    s_churn=0,
    s_tmax=0,
    s_tmin=0,
    s_noise=1,
    override_settings={},
    override_settings_restore_afterwards=True,
    sampler=None,
    include_init_images=False,
    controlnet_units: List[ControlNetUnit] = [],
    use_deprecated_controlnet=False,
    outpath_samples="",
    sd_vae="vae-ft-mse-840000-ema-pruned.ckpt",
    sd_model_checkpoint="Chilloutmix-Ni-pruned-fp16-fix.safetensors",
    animatediff_flag=False,
    animatediff_video_length=0,
    animatediff_fps=0,
    animatediff_reserve_scale=1,
    animatediff_last_image=None,
    loractl_flag=False,
):
    """
    Perform image-to-image inpainting.

    Args:
        images (list): List of input images.
        resize_mode (int): Resize mode.
        denoising_strength (float): Denoising strength.
        image_cfg_scale (float): Image configuration scale.
        mask_image (PIL.Image.Image): Mask image.
        mask_blur (int): Mask blur strength.
        inpainting_fill (int): Inpainting fill value.
        inpaint_full_res (bool): Flag to inpaint at full resolution.
        inpaint_full_res_padding (int): Padding size for full resolution inpainting.
        inpainting_mask_invert (int): Invert the mask flag.
        initial_noise_multiplier (int): Initial noise multiplier.
        prompt (str): Prompt text.
        styles (list): List of styles.
        seed (int): Seed value.
        subseed (int): Subseed value.
        subseed_strength (int): Subseed strength.
        seed_resize_from_h (int): Seed resize height.
        seed_resize_from_w (int): Seed resize width.
        batch_size (int): Batch size.
        n_iter (int): Number of iterations.
        steps (list): List of steps.
        cfg_scale (float): Configuration scale.
        width (int): Output image width.
        height (int): Output image height.
        restore_faces (bool): Restore faces flag.
        tiling (bool): Tiling flag.
        do_not_save_samples (bool): Do not save samples flag.
        do_not_save_grid (bool): Do not save grid flag.
        negative_prompt (str): Negative prompt text.
        eta (float): Eta value.
        s_churn (int): Churn value.
        s_tmax (int): Tmax value.
        s_tmin (int): Tmin value.
        s_noise (int): Noise value.
        override_settings (dict): Dictionary of override settings.
        override_settings_restore_afterwards (bool): Flag to restore override settings afterwards.
        sampler: Sampler.
        include_init_images (bool): Include initial images flag.
        controlnet_units (List[ControlNetUnit]): List of control net units.
        use_deprecated_controlnet (bool): Use deprecated control net flag.
        outpath_samples (str): Output path for samples.
        sd_vae (str): VAE model checkpoint.
        sd_model_checkpoint (str): Model checkpoint.
        animatediff_flag (bool): Animatediff flag.
        animatediff_video_length (int): Animatediff video length.
        animatediff_fps (int): Animatediff video FPS.
        loractl_flag (bool): Whether to append LoRA weight in all steps to `gen_image` or not.

    Returns:
        gen_image (Union[PIL.Image.Image, List[PIL.Image.Image]]): Generated image.
    """
    if sampler is None:
        sampler = "Euler a"
    if steps is None:
        steps = 20

    # Pass sd_model to StableDiffusionProcessingTxt2Img does not work.
    # We should modify shared.opts.sd_model_checkpoint instead.
    p_img2img = StableDiffusionProcessingImg2Img(
        outpath_samples=outpath_samples,
        do_not_save_samples=do_not_save_samples,
        outpath_grids=opts.outdir_grids or opts.outdir_img2img_grids,
        prompt=prompt,
        negative_prompt=negative_prompt,
        styles=[],
        seed=seed,
        subseed=subseed,
        subseed_strength=subseed_strength,
        seed_resize_from_h=seed_resize_from_h,
        seed_resize_from_w=seed_resize_from_w,
        sampler_name=sampler,
        batch_size=batch_size,
        n_iter=n_iter,
        steps=steps,
        cfg_scale=cfg_scale,
        width=width,
        height=height,
        restore_faces=restore_faces,
        tiling=tiling,
        init_images=images,
        mask=mask_image,
        mask_blur=mask_blur,
        inpainting_fill=inpainting_fill,
        resize_mode=resize_mode,
        denoising_strength=denoising_strength,
        image_cfg_scale=image_cfg_scale,
        inpaint_full_res=inpaint_full_res,
        inpaint_full_res_padding=inpaint_full_res_padding,
        inpainting_mask_invert=inpainting_mask_invert,
        override_settings=override_settings,
        initial_noise_multiplier=initial_noise_multiplier,
    )
    p_img2img.scripts = scripts.scripts_img2img
    p_img2img.extra_generation_params["Mask blur"] = mask_blur
    p_img2img.script_args = init_default_script_args(p_img2img.scripts)

    shared.opts.return_mask = False
    shared.opts.return_mask_composite = False
    if "control_net_no_detectmap" in shared.opts.data.keys():
        shared.opts.data["control_net_no_detectmap"] = True

    if animatediff_flag:
        before_pad_cond_uncond = copy.deepcopy(opts.pad_cond_uncond)
        opts.pad_cond_uncond = True

        animate_diff_process = AnimateDiffProcess(
            enable=True,
            video_length=len(images) if animatediff_video_length == 0 else animatediff_video_length,
            fps=animatediff_fps,
            i2i_reserve_scale=animatediff_reserve_scale,
            last_frame=animatediff_last_image,
            latent_scale=len(images) if animatediff_video_length == 0 else int(animatediff_video_length / 4 * 3),
            latent_scale_last=len(images) if animatediff_video_length == 0 else int(animatediff_video_length / 4 * 1),
        )
        controlnet_units = [ControlNetUnit(**controlnet_unit) for controlnet_unit in controlnet_units]
    else:
        from scripts import external_code

        animate_diff_process = None
        controlnet_units = [external_code.ControlNetUnit(**controlnet_unit) for controlnet_unit in controlnet_units]

    for alwayson_scripts in modules.scripts.scripts_img2img.alwayson_scripts:
        if hasattr(alwayson_scripts, "name"):
            if alwayson_scripts.name is None:
                continue
            if alwayson_scripts.name == "controlnet":
                p_img2img.script_args[alwayson_scripts.args_from : alwayson_scripts.args_from + len(controlnet_units)] = controlnet_units
            if alwayson_scripts.name == "animatediff_easyphoto" and animate_diff_process is not None:
                p_img2img.script_args[alwayson_scripts.args_from] = animate_diff_process
            if "dynamic lora weights" in alwayson_scripts.name:
                # All LoRAs in the additional prompt will be wrapped with LoraCtlNetwork rather than ExtraNetworkLora.
                p_img2img.script_args[alwayson_scripts.args_from] = True  # Enable Dynamic Lora Weights
                p_img2img.script_args[alwayson_scripts.args_from + 1] = loractl_flag  # Plot the LoRA weight in all steps
        else:
            if alwayson_scripts.title().lower() is None:
                continue
            if alwayson_scripts.title().lower() == "controlnet":
                p_img2img.script_args[alwayson_scripts.args_from : alwayson_scripts.args_from + len(controlnet_units)] = controlnet_units
            if alwayson_scripts.title().lower() == "animatediff_easyphoto" and animate_diff_process is not None:
                p_img2img.script_args[alwayson_scripts.args_from] = animate_diff_process
            if "dynamic lora weights" in alwayson_scripts.title().lower():
                # All LoRAs in the additional prompt will be wrapped with LoraCtlNetwork rather than ExtraNetworkLora.
                p_img2img.script_args[alwayson_scripts.args_from] = True  # Enable Dynamic Lora Weights
                p_img2img.script_args[alwayson_scripts.args_from + 1] = loractl_flag  # Plot the LoRA weight in all steps
    p_img2img.seed = int(seed)
    p_img2img.steps = steps

    processed = processing.process_images(p_img2img)

    if animatediff_flag:
        opts.pad_cond_uncond = before_pad_cond_uncond

    return processed.images

    Perform image-to-image inpainting.

    Args:
        images (list): List of input images.
        resize_mode (int): Resize mode.
        denoising_strength (float): Denoising strength.
        image_cfg_scale (float): Image configuration scale.
        mask_image (PIL.Image.Image): Mask image.
        mask_blur (int): Mask blur strength.
        inpainting_fill (int): Inpainting fill value.
        inpaint_full_res (bool): Flag to inpaint at full resolution.
        inpaint_full_res_padding (int): Padding size for full resolution inpainting.
        inpainting_mask_invert (int): Invert the mask flag.
        initial_noise_multiplier (int): Initial noise multiplier.
        prompt (str): Prompt text.
        styles (list): List of styles.
        seed (int): Seed value.
        subseed (int): Subseed value.
        subseed_strength (int): Subseed strength.
        seed_resize_from_h (int): Seed resize height.
        seed_resize_from_w (int): Seed resize width.
        batch_size (int): Batch size.
        n_iter (int): Number of iterations.
        steps (list): List of steps.
        cfg_scale (float): Configuration scale.
        width (int): Output image width.
        height (int): Output image height.
        restore_faces (bool): Restore faces flag.
        tiling (bool): Tiling flag.
        do_not_save_samples (bool): Do not save samples flag.
        do_not_save_grid (bool): Do not save grid flag.
        negative_prompt (str): Negative prompt text.
        eta (float): Eta value.
        s_churn (int): Churn value.
        s_tmax (int): Tmax value.
        s_tmin (int): Tmin value.
        s_noise (int): Noise value.
        override_settings (dict): Dictionary of override settings.
        override_settings_restore_afterwards (bool): Flag to restore override settings afterwards.
        sampler: Sampler.
        include_init_images (bool): Include initial images flag.
        controlnet_units (List[ControlNetUnit]): List of control net units.
        use_deprecated_controlnet (bool): Use deprecated control net flag.
        outpath_samples (str): Output path for samples.
        sd_vae (str): VAE model checkpoint.
        sd_model_checkpoint (str): Model checkpoint.
        animatediff_flag (bool): Animatediff flag.
        animatediff_video_length (int): Animatediff video length.
        animatediff_fps (int): Animatediff video FPS.
        loractl_flag (bool): Whether to append LoRA weight in all steps to `gen_image` or not.

    Returns:
        gen_image (Union[PIL.Image.Image, List[PIL.Image.Image]]): Generated image.
    
scripts/sdwebui.py