Skip to content

How to use inpainting

stassius edited this page May 27, 2023 · 3 revisions

What's inpainting?

Inpainting is the process when you alter only a part of your image, usually respecting the shape of the mask. So if you paint a fish-shaped mask, it will generate a fish.

Set up

To use inpainting, switch to image2image mode on the SD Dream node. In the Images tab tick the Use Mask checkbox. You'll get a new set of parameters.

image

Mask is a black and white image. I would advice to remove the alpha-channel from it.

First, choose the mask source, it could be an upstream image, or a particular file.

White parts of your mask will be inpainted. You can tick Invert Mask to change this behavior.

Masked Content is an important setting. It could be set to original - it means, that your initial image will fill the mask shape before the generation. If you want to generate something completely new, choose Noise here.

You can blur your mask.

Inpaint Full Res means that the image will be scaled to the size of your mask with the selected Inpaint padding (pixels around it). This option could improve the generation on small parts of the image, but also can lead to artifacts, as neural network will only see the enlarged part of the image. So change your prompt accordingly.

Which model to use?

For the inpainting to take into account the shape of the mask, you have to use a checkpoint that ends with _inpainting.

Or, since the ControlNet 1.1 you can use whatever model you like. Just add a ControlNet, select Inpaint preprocessor and the control_v11p_sd15_inpaint model. Change Image Type to File and delete the filename, it should be empty! After that ControlNet will use the mask you selected in the Images tab.

image