Start studying
Module 12 · Generative AI Module contents
Module 12  ·  Card 9 / 18intermediate

Inpainting and Outpainting

Inpainting regenerates a masked region of an existing image and leaves the rest untouched.

It is how objects are removed, faces are fixed and blemishes disappear from a photograph.

Outpainting is the same idea aimed outward, extending the picture beyond its original edges.

Both work because the model conditions on the surrounding pixels as well as on the prompt.

The seam is the hard part, so the mask is usually feathered and the region slightly overlapped.

Learn in depth ↓
Module 12 · Generative AI · 18 concepts
In depth  /  15 lines

Inpainting and Outpainting, in more detail

Generating an image from nothing is the demonstration; editing one is the actual work.

Inpainting is the editing operation: mark a region and have the model regenerate only that region.

Everything outside the mask is preserved exactly, which is what makes it an edit rather than a new image.

The model receives three things: the masked image, the mask itself, and a text prompt.

Conditioning on the surrounding pixels is essential and is what makes the result blend in.

It is how lighting direction, film grain, perspective and colour temperature carry across the boundary.

Typical uses are removing an unwanted object, replacing a background, or changing one item of clothing.

Outpainting applies the same machinery beyond the frame instead of inside it.

The original image is placed on a larger empty canvas and the new area is treated as the mask.

That is how a portrait becomes a wide shot, or a square image is extended to a banner.

The recurring difficulty in both is the seam where generated pixels meet original ones.

Feathering the mask edge and letting the generated region overlap slightly hides most of it.

Working at the model's native resolution matters, since scaling artefacts show up along the boundary.

Repeated outpainting drifts, because each pass conditions on the previous pass's output.

Modern instruction-based editors wrap all of this behind a sentence, but the mechanism underneath is unchanged.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What does a model condition on when inpainting a masked region?
Generative AI

18 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close