Guide to Inpainting with Stable Diffusion

Edit images using only text and your imagination.

In image editing, inpainting is a process of restoring missing parts of pictures. Most commonly applied to reconstructing old deteriorated images, removing cracks, scratches, dust spots, or red-eyes from photographs.

But with the power of AI and the Stable Diffusion model, inpainting can be used to achieve more than that. For example, instead of just restoring missing parts of an image, it can be used to render something entirely new in any part of an existing picture. Your imagination only limits it.

Let's look at a simple example of inpainting with AI Editor. We will use 'Girl with a Pearl Earring' by Johannes Vermeer as a base. Firstly let's create a new project and upload the picture onto the canvas.

We will try to use inpainting to replace the girl's 'turban' with red hair. So let's erase it. Just click on the Eraser icon on the top, select the brush size, and drag over the part you want to be replaced. Just like in any other graphics editor. But remember to ensure that the object is entirely removed, as even a couple of pixels present can guide Stable Diffusion in the wrong direction.

Now we can use AI to render something new in that empty spot. To do this, move the 'Generation Frame' in such a way that it covers the erased part. Make sure you have 'Inpaint / Outpaint,' selected, describe what you want to see, and click 'Generate.'

AI Editor with the power of Stable Diffusion provides you with four images to choose. You can accept what you like the most and continue editing, or cancel and start over to get more examples.

Finally, we can compare the initial image with our outcome. Stable Diffusion Inpainting not only rendered exactly what we wanted to see in the missing spot but also seamlessly matched the style of a source image.

'Girl with a Pearl Earring''Girl with a Red Hair'

We hope our guide helped you understand how inpainting works with Stable Diffusion, and you will use what you've learned alongside your creativity to make something exceptional. If so, please join our Discord and share it with our amazing community.