What Is Inpainting in AI Image Editing?
Inpainting is the difference between editing a photograph and producing a new one that looks similar. Once you know which of those an AI tool is doing, a lot of confusing results stop being confusing.
Inpainting is regenerating one selected region of an existing image while leaving every other pixel exactly as it was. You supply the image, a mask marking the area to change, and a description of what should be there instead. The model rebuilds only the masked region, conditioned on what surrounds it so the result matches in lighting, perspective and grain.
The word comes from art conservation, where inpainting means filling a damaged section of a painting so the repair disappears into the original. The computational version inherits both the technique and the standard it is judged against, and it sits on the same generative machinery described in how AI models work, pointed at a much narrower target.
The Property That Makes It Useful
If you ask an image model to "make this photo but without the parked car", you get a new photograph. It will resemble yours. The faces will be subtly different people, the brickwork will be different brickwork, and the client who took the original will notice. Regenerating an image is not editing it.
Inpainting does not have this problem, because the pixels outside the mask never enter the generation. They are copied. Whatever was true of the original, the actual faces, the actual product, the specific light on a specific afternoon, stays true everywhere you did not paint. Only the masked region is invented.
That single property is why inpainting is the workhorse of practical image editing while text-to-image generation is the workhorse of concepting.
Inpainting, Outpainting and Generation
Operation | What you provide | What changes | Typical use |
|---|---|---|---|
Generation | A prompt | Everything, nothing is preserved | Concepts, illustrations, stock-style imagery |
Inpainting | Image, mask, prompt | Only inside the mask | Remove an object, replace a sky, fix a detail |
Outpainting | Image, prompt | New area added beyond the original edges | Change aspect ratio, extend a background |
Instruction editing | Image, instruction | Whatever the model decides matches the instruction | Quick edits where you accept less control |
Outpainting is inpainting pointed outwards: the same fill-the-unknown-region machinery, with the unknown region being canvas that did not exist. It is how a portrait-orientation photo becomes a wide banner without cropping the subject.
Instruction editing is the newest of the four and the most convenient, since you skip the mask entirely and say "remove the car". The trade is control. The model decides the boundary, and when it decides wrong you have no direct way to correct it other than rephrasing.
How the Mask Actually Works
A mask is a black-and-white image the same size as your photograph: white where the model may generate, black where it must not, as the Hugging Face diffusers inpainting guide sets out. Most tools hide this behind a brush, but knowing it is a separate image explains the two decisions that determine whether a result looks right.
Mask size. Too tight and the model has no room to blend, producing a visible patch. Too loose and you regenerate detail you wanted to keep. The usual fix for a bad result is a slightly larger mask, not a better prompt.
Edge softness. A hard-edged mask gives the model a sharp boundary to resolve and a sharp boundary is where seams appear. A few pixels of feathering lets the transition fall inside a blended region instead.
The model sees the unmasked surroundings as context, which is what makes the fill plausible. Remove a bottle from a table and the model can see the table's wood grain, the shadow direction and the depth of field, and continue all three. This is also why inpainting fails on large masks: cover half the image and there is not enough context left to condition on, so you are effectively back to generation.
Where It Goes Wrong
The seam. Sharpness, noise and colour temperature inside the mask can differ subtly from outside. It is most visible on skin, sky gradients and anything with consistent film grain.
Repeated structure. Regenerated brickwork, tiling or text will not line up with the original grid. Anything with a regular pattern crossing the mask boundary is a hard case.
Implied physics. Remove an object and its shadow and reflection remain unless they fell inside your mask. This is the single most common giveaway in a rushed edit.
Text in the region. Inpainted text garbles for the same structural reason AI image models cannot spell in the first place.
Faces. Small facial regions are where the human eye is most sensitive to a mismatch, and where the smallest inconsistency reads as wrong.
The standard remedy for all of these is iteration: mask, generate, look at the boundary at full resolution, adjust the mask, go again. Judging an inpaint from a thumbnail is how bad edits ship.
When to Reach for It
Inpainting is the right tool when the original image is the point. Removing a distracting object from a real product photo, swapping a flat grey sky for a better one, cleaning a blemish, extending a background so an image fits a different crop. In all of these the photograph carries the value and you are making a targeted correction.
It is the wrong tool when you do not actually need this image, you need an image. Generating fresh is faster and gives better composition than fighting an inpaint into a picture it was never going to become. The same judgement applies as in any generation work, and the prompt craft in writing AI image generation prompts carries over directly, since the masked region is still described with a prompt.
One caution worth carrying: inpainting edits photographs convincingly, which makes it as much a provenance question as a creative one. The broader risks around generated and altered imagery are covered in the risks that come with AI systems, and a plain disclosure habit costs nothing.
Frequently Asked Questions
What is the difference between inpainting and outpainting?
Inpainting regenerates a region inside the existing image. Outpainting generates new area beyond its original edges. Both fill an unknown region using the surrounding image as context.
Does inpainting change the rest of my photo?
No. Pixels outside the mask are preserved exactly. That is the defining property, and it is what separates inpainting from regenerating a similar-looking image.
Why does my inpainted area look pasted in?
Usually a mask that is too tight or too hard-edged. Enlarge the mask a little and feather the edge so the model has room to blend, then compare at full resolution rather than in a thumbnail.
Can inpainting remove an object completely?
Yes, if you mask the object and everything it implies. Shadows and reflections left outside the mask are the usual reason a removal still looks wrong.
Do I need a special model for inpainting?
Many image models accept a mask directly, and some editing models take a painted mark or instruction instead. The capability varies by model, so check what the specific one accepts before designing a workflow around it.
How did this land?
About the author

Senior Editor, AI & Product
Cecilia leads the Swarmz editorial desk. She has spent a decade turning complex AI and product topics into writing people actually finish, and she owns the blog's quality bar.


