Skip to content

Commit

Permalink
Fix for AUTOMATIC1111#10643 (pixel noise in webui inpainting canvas b…
Browse files Browse the repository at this point in the history
…reaking inpainting, so that it behaves like plain img2img)
  • Loading branch information
ArthurHeitmann authored and dario-github committed Jun 27, 2023
1 parent 7fa69bc commit d6048cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion modules/img2img.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s
elif mode == 2: # inpaint
image, mask = init_img_with_mask["image"], init_img_with_mask["mask"]
alpha_mask = ImageOps.invert(image.split()[-1]).convert('L').point(lambda x: 255 if x > 0 else 0, mode='1')
mask = ImageChops.lighter(alpha_mask, mask.convert('L')).convert('L')
mask = mask.convert('L').point(lambda x: 255 if x > 128 else 0, mode='1')
mask = ImageChops.lighter(alpha_mask, mask).convert('L')
image = image.convert("RGB")
elif mode == 3: # inpaint sketch
image = inpaint_color_sketch
Expand Down

0 comments on commit d6048cb

Please sign in to comment.