[Bug]: Inpaint thinks black background is part of the mask
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
I take an image that was created with txt2img, modified with inpainting, then modified with an image editor (Photopea) before being put back into Inpaint. It happens to have a large area that is #000000 total black. When I try to inpaint part of the image, it includes much of that black background as if it was part of the mask. When in the image editor I add #010000 to remove the black background then the problem goes away. Therefore it seems that inpainting treats #000000 pixels as if they were part of the mask.
Steps to reproduce the problem
- Go to Inpaint
- Load an image with a black background like https://www.mediafire.com/view/j6t1kfqan8tk2wb/15360-black_background.png/file
- Inpaint literally anything, like say a hand
- Select
Only masked - See how the black background area is included
- Do the same with an image with no black background like https://www.mediafire.com/view/mqddujgu07godfi/15360-red_background.png/file
- See how only the masked area is included
Pic is what happens with the black background when only the hand is inpainted

What should have happened?
Pic is what happens with the #010000 background when only the hand is inpainted (same everything as the previous screenshot).

Commit where the problem happens
https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
What platforms do you use to access the UI ?
Windows
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
--medvram --opt-split-attention --skip-torch-cuda-test --opt-sub-quad-attention
List of extensions
| Extension | URL | Version | Update |
|---|---|---|---|
| openpose-editor | https://github.com/fkunn1326/openpose-editor.git | cc742cb8 (Mon Feb 27 23:26:31 2023) | unknown |
| sd-webui-controlnet | https://github.com/Mikubill/sd-webui-controlnet | 3a1c5b9f (Mon Feb 27 19:57:39 2023) | unknown |
| LDSR | built-in | ||
| Lora | built-in | ||
| ScuNET | built-in | ||
| SwinIR | built-in | ||
| prompt-bracket-checker | built-in |
Console logs
venv "C:\msys\home\sd\sd\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: 0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8
Installing requirements for Web UI
Launching Web UI with arguments: --medvram --opt-split-attention --opt-sub-quad-attention
No module 'xformers'. Proceeding without it.
Loading weights [03df69045a] from C:\msys\home\sd\sd\models\Stable-diffusion\stablydiffuseds_26.safetensors
Creating model from config: C:\msys\home\sd\sd\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\msys\home\sd\sd\models\VAE\vae-ft-mse-840000-ema-pruned.safetensors
Applying sub-quadratic cross attention optimization.
Textual inversion embeddings loaded(2): bad_prompt_version2, bottomless_embed
Model loaded in 10.8s (load weights from disk: 0.3s, create model: 1.2s, apply weights to model: 6.6s, apply half(): 1.9s, load VAE: 0.7s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
9%|███████▊ | 3/32 [00:14<02:16, 4.71s/it]
Total progress: 0%| | 3/3200 [00:12<3:44:59, 4.22s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 32/32 [02:34<00:00, 4.83s/it]
100%|██████████████████████████████████████████████████████████████████████████████████| 32/32 [02:37<00:00, 4.91s/it]
97%|███████████████████████████████████████████████████████████████████████████████▍ | 31/32 [02:33<00:04, 4.91s/it]
Total progress: 3%|█▊ | 95/3200 [07:45<4:14:00, 4.91s/it]
Additional information
No response