What is Inpainting in Web UI Stable Diffusion

Hello everyone, how’s your day going?
Today, I want to talk about Inpainting, a highly useful feature within Web UI Stable Diffusion’s Automatic1111.

Inpainting

Inpainting is a conservation technique where damaged, deteriorated, or missing parts of an artwork are filled in to present a complete image. This method is widely used in image restoration, applicable to both physical and digital art forms, such as oil or acrylic paintings, chemical photographic prints, sculptures, or digital images and videos.

Inpainting Banner

Inpainting in Stable Diffusion is a popular feature that allows users to mask the part of an image they wish to change with a brush and easily replace it with a different image. It’s a significant advantage of stable diffusion, enabling users to regenerate selected areas or recreate areas outside the selected region. Now, let’s delve into how to use this feature effectively.

1. Creating the Image You Want

If you’ve installed Stable Diffusion, you’ve probably experimented with your favorite base models and LoRA mixtures to produce fantastic results. For those who haven’t tried it yet, let’s walk through the process of image creation.

If you haven’t installed Stable Diffusion yet, follow the link below for a quick setup.

–> Go to Post(How to install Stable Diffusion)

Once everything is ready, head to the Txt2Img tab, input your prompts, and generate the image you desire. For beginners, here are the settings I use, which you can follow to make the process easier.

Settings

  • Base Model: realcartoonPixar_v5.safetensors
  • VAE: Automatic
  • Positive Prompt: masterpiece, best quality, 1girl, blond wavy hair, upper body, classic spidersuit under white jacket, comics and dolls in pink room, <lora:armspiderverse_v3:1>
  • Negative Prompt: ng_deepnegative_v1_75t,(badhandv4:1.2),(worst quality:2),(low quality:2),(normal quality:2),lowres,bad anatomy,bad hands,((monochrome)),((grayscale)),((watermark)),(((nude))),(((naked))),((signature)),((logo)),extra limbs,
  • Sampling Method: DPM++ SDE Karras
  • Sampling Steps: 30
  • Size: 512×512
  • CFG: 7
  • Seed: -1
image 87
Generated Image in Txt2Img

Isn’t it amazing?
I particularly enjoy creating images of stylishly suited heroes. Feel free to play with the Batch Count setting to experience a range of outputs under the same configuration.

2. How to use Inpainting

Once you’re happy with your output, click the ‘Send to Img2Img’ button below the image.

Unlike Txt2Img, which generates images from various words and sentences, the Img2Img tab allows for the creation of diverse outputs based on a specified image. You can access Img2Img next to the Txt2Img tab or use the button mentioned earlier.

1 15
Send to Img2Img

Our focus today is on Inpainting, which lets you change specific parts of the chosen image. Once in Img2Img, click the Inpaint tab. Here, you can draw on the image with your mouse, creating a mask with a Mask Blur gauge.

As shown, draw over the parts of the image you want to change. In design tools, black and white concepts are often applied in a layer called ‘Mask.’
This concept is similarly applied in Inpainting in Automatic1111, where the black or white-masked areas are set for reconstruction.

After masking the desired areas, let’s regenerate the image. The prompts and settings from your initial creation should also be transferred. If you wish to modify the masked areas differently, adjust the prompts slightly for more varied and exciting results.

image 88
Msking Area Only

I painted over the face area and added “Pink Sunglasses” to the Positive Prompt. Then, I selected the ‘Masking Area Only’ option in the settings and generated the image. As you can see, by choosing ‘Masking Area Only,’ the system regenerates only that specific part of the image instead of the whole. This approach seems very time-efficient.

2 12
Generated Image by Inpainting

Ta-da! After several attempts at inpainting, I changed the hair color and the mood of the face. It’s different from the face swap I mentioned earlier, but isn’t it incredible that you can specifically alter parts to exactly what you want? I encourage you all to try inpainting now and put the finishing touches on your amazing creations!

Next time, I’ll talk about more in-depth tips for working with these tools, so stay tuned!

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart