Fix a bug where the inpainting mask wasn't resized to the image size when using the WebUI/v3.5 backend. Thanks @AvidGameFan for their help in investigating and fixing this!

This commit is contained in:
cmdr2 2025-02-08 11:25:28 +05:30
parent a1fb9bc65c
commit a8b1bbe441
2 changed files with 5 additions and 1 deletions

View File

@ -195,7 +195,7 @@ def generate_images(
cmd["init_images"] = [init_image]
cmd["denoising_strength"] = prompt_strength
if init_image_mask:
cmd["mask"] = init_image_mask
cmd["mask"] = init_image_mask if isinstance(init_image_mask, str) else img_to_base64_str(init_image_mask)
cmd["include_init_images"] = True
cmd["inpainting_fill"] = 1
cmd["initial_noise_multiplier"] = 1

View File

@ -240,6 +240,10 @@ def generate_images_internal(
if req.init_image is not None and int(req.num_inference_steps * req.prompt_strength) == 0:
req.prompt_strength = 1 / req.num_inference_steps if req.num_inference_steps > 0 else 1
if req.init_image_mask:
req.init_image_mask = get_image(req.init_image_mask)
req.init_image_mask = resize_img(req.init_image_mask.convert("RGB"), req.width, req.height, clamp_to_8=True)
backend.set_options(
context,
output_format=output_format.output_format,