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.