Closed sygi closed 1 year ago
Should work now.
Not sure if that's related, but right now clicking on the thumbnail switches into "upload mask" (from "draw mask" mode).
Yes, if there is a border in the selection it will switch mode to upload the mask too. If you select a region without any border it will switch to draw mask mode when sending the image.
But if you are in the img2img Tab it will transfer only the image. In this mode it will do outpainting (with a different noise pattern than inpainting) using black(0,0,0) as a mask_color to determine which pixels need to be replaced. (alphaCanvas must be selected as a script for this mode to work, while the inpainting itself only uses the js-ui portion of the script)
IMO that's a bug: it shouldn't be the canvas that chooses the mode for defining mask, as you can both want to upload an external mask when handling the inside of the image or (like I did) change something internal to the image while also generating something outside of the border.
Also, throwing the mask away that the user drew because they tried to bring a new image is super annoying.
I'm not sure what the intended usecase for the "masked" inpainting was, given that as you write if you were to outpaint, you could use the other tab, and changing only a piece of the image in the corner still won't work, as the black mask will be added to the image.
The behavior is
User is in img2img tab:
User is in the inpainting tab:
If there are border pixels both mask and RGB will be transferred to the interface. Also, the mask mode is set to "uploadMask". A painted mask will NOT be deleted. Both mask and image can still be changed by hand after transfer. This outpainting method can also handle perfect black.
If there are no edge pixels, only the rgb image is transferred to the interface and the mask mode is set to "draw Mask". Normal inpainting from this point on. Drawn Mask itself is never touched.
Both outpainting methods have their advantages. The method in img2img tries to use a suitable noise from the existing image as a basis for the new pixels. But it can't do a perfect black.
The outpainting in the inpainting tab can handle proper black, and often the randomNoise is even better than the matching noise from img2img.
From my point of view, it all works as intended.
Maybe I am the only one with that workflow, but to me, it's convenient to be able to do both outpainting and changing parts of the image (inpainting) in the same run. Changing the mask in "uploadMask" mode is not as convenient as drawing and I prefer to do it in the draw mode, allowing me to choose whether I want to only inpaint or both.
For the images < 512, this is the only way to have inpainting done without drawing the mask externally.
Yes, it can sometimes be irritating if you have just a few border pixel in your selection and you are put in "masked Mode".
And in the case of 512x512 or lower it makes no sense to use the canvas. You can just load it as a source image.
But a better solution to define the mode would be nice.
I observed that if you have a pending patch (red border), if you click on a current thumbnail, it will move it from the alphacanvas to SD canvas, and the old (red) pending patch will disappear, but a new one won't open.
It would be nice if clicking on a thumbnail always opened a new patch, even if one was previously pending.