AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
142.51k stars 26.88k forks source link

Upload Mask function is broken! (Inpaint Masked) #1188

Closed ZeroCool22 closed 2 years ago

ZeroCool22 commented 2 years ago

https://user-images.githubusercontent.com/13344308/192625881-305d7bcb-b627-4960-b137-2e87931205c6.mp4

It doesn't respect the Masked Area, it paints outside the mask.

Xyem commented 2 years ago

From my understanding, this is what I would expect to happen. You are providing an image for the mask, which is expected to be black and white, where white is the area to replace. The changes you are seeing happen on the horizon, which is lighter coloured but the ship is not changed, where the mask is black (and other dark areas of the image look unchanged too).

I think what you were expecting to be able to do is where you provide the image only (no mask upload), with transparency on the image, denoting the mask. In other words, from the list below you might be expecting to be doing 2, but you are doing 3 instead by uploading a mask image.

Options for inpainting:

1. draw a mask yourself in web editor
2. erase a part of picture in external editor and upload a transparent picture. Any even slightly transparent areas will become part of the mask. Be aware that [some editors](https://docs.krita.org/en/reference_manual/layers_and_masks/split_alpha.html#how-to-save-a-png-texture-and-keep-color-values-in-fully-transparent-areas) save completely transparent areas as black by default.
3. change mode (to the bottom right of the picture) to "Upload mask" and choose a separate black and while image for mask (white=inpaint).

Hope this helps!

ZeroCool22 commented 2 years ago

From my understanding, this is what I would expect to happen. You are providing an image for the mask, which is expected to be black and white, where white is the area to replace. The changes you are seeing happen on the horizon, which is lighter coloured but the ship is not changed, where the mask is black (and other dark areas of the image look unchanged too).

I think what you were expecting to be able to do is where you provide the image only (no mask upload), with transparency on the image, denoting the mask. In other words, from the list below you might be expecting to be doing 2, but you are doing 3 instead by uploading a mask image.

Options for inpainting:

1. draw a mask yourself in web editor
2. erase a part of picture in external editor and upload a transparent picture. Any even slightly transparent areas will become part of the mask. Be aware that [some editors](https://docs.krita.org/en/reference_manual/layers_and_masks/split_alpha.html#how-to-save-a-png-texture-and-keep-color-values-in-fully-transparent-areas) save completely transparent areas as black by default.
3. change mode (to the bottom right of the picture) to "Upload mask" and choose a separate black and while image for mask (white=inpaint).

Hope this helps!

The mask now is done in "Black" (with the brush APP) color, in previous versions it was White.

But, i will try to delete the part i want changed in PS and let it be transparent, will write back if this worked or not.

Mozoloa commented 2 years ago

I believe the mask image should be black and white, white being the part you want to change, regardless of the colour the brush does in the UI, right now you're not gonna change anything, I mean just a little on the rest of the image and 0 on the cloud.

An alpha mask is only white masks over black

ZeroCool22 commented 2 years ago

I believe the mask image should be black and white, white being the part you want to change, regardless of the colour the brush does in the UI, right now you're not gonna change anything, I mean just a little on the rest of the image and 0 on the cloud.

An alpha mask is only white masks over black

Ok, so you mean i paint white the little UFO and the rest of the image black? So the white part must change?

ZeroCool22 commented 2 years ago

I believe the mask image should be black and white, white being the part you want to change, regardless of the colour the brush does in the UI, right now you're not gonna change anything, I mean just a little on the rest of the image and 0 on the cloud.

An alpha mask is only white masks over black

Got it now!

Masked ufo

Should be like this, (now trying to add 2 Bodies).

Thx!

Xyem commented 2 years ago

Yes, if you want to upload a mask image (black and white), you would paint everything black, except the area you want to change (e.g. UFO). I have added a little comparison of the three methods (web interface, alpha masking, mask file).

2022-09-27-234814_822x735_scrot

songib commented 1 year ago

Omg, this stuff is not intuitive at all. ngnl. I just try a bunch of settings and got confused by it.