diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-05-22 20:22:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-22 20:22:34 +0000 |
commit | 80a723cbcfcb5cfb52dc3ebe43988052a29b6cce (patch) | |
tree | 037823a91db6dc822669eaaca9b019d32bd9a77d /modules/img2img.py | |
parent | 809001fe41e8d34a58537ae03ef46c66a68fb32c (diff) | |
parent | e1c44267ea239d0903202c41f9e75c864e31227f (diff) | |
download | stable-diffusion-webui-gfx803-80a723cbcfcb5cfb52dc3ebe43988052a29b6cce.tar.gz stable-diffusion-webui-gfx803-80a723cbcfcb5cfb52dc3ebe43988052a29b6cce.tar.bz2 stable-diffusion-webui-gfx803-80a723cbcfcb5cfb52dc3ebe43988052a29b6cce.zip |
Merge pull request #10644 from ArthurHeitmann/fix-inpainting-canvas-noise
Fix for #10643 (Inpainting mask sometimes not working)
Diffstat (limited to 'modules/img2img.py')
-rw-r--r-- | modules/img2img.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/modules/img2img.py b/modules/img2img.py index d704bf90..4c12c2c5 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -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
|