diff options
author | catboxanon <122327233+catboxanon@users.noreply.github.com> | 2023-08-04 09:31:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 09:31:38 +0000 |
commit | df9fd1d3ae5e01a9de67ba4aa34e96e9f789704a (patch) | |
tree | a14a8725ab2c4927bbd0a1b639cf47ef84587ffc | |
parent | 2e613a6ffc65ed5edf439abc7f5e482698ade02a (diff) | |
download | stable-diffusion-webui-gfx803-df9fd1d3ae5e01a9de67ba4aa34e96e9f789704a.tar.gz stable-diffusion-webui-gfx803-df9fd1d3ae5e01a9de67ba4aa34e96e9f789704a.tar.bz2 stable-diffusion-webui-gfx803-df9fd1d3ae5e01a9de67ba4aa34e96e9f789704a.zip |
Fix inpaint mask for Gradio 3.39.0
-rw-r--r-- | modules/img2img.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/modules/img2img.py b/modules/img2img.py index 68e415ef..4ae2ba72 100644 --- a/modules/img2img.py +++ b/modules/img2img.py @@ -129,9 +129,7 @@ def img2img(id_task: str, mode: int, prompt: str, negative_prompt: str, prompt_s mask = None
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 = mask.convert('L').point(lambda x: 255 if x > 128 else 0, mode='1')
- mask = ImageChops.lighter(alpha_mask, mask).convert('L')
+ mask = mask.convert('RGBA').split()[3].convert('L').point(lambda x: 255 if x > 0 else 0)
image = image.convert("RGB")
elif mode == 3: # inpaint sketch
image = inpaint_color_sketch
|