AI Generation

Inpainting: Editing Inside a Mask

Also called what is inpainting, ai inpainting, video inpainting, generative fill, masked editing

Inpainting regenerates the pixels inside a mask you draw and leaves everything outside it untouched. It is how you remove an object, swap a detail, or repair a mistake without re-rendering the whole picture, and the quality of the result depends far more on the mask than on the prompt.

What the model sees

An inpainting pass gets three inputs: the image, a mask marking the region to replace, and a prompt describing what should be there. The model generates new content for the masked region while conditioning on the surrounding pixels, so it can match lighting, texture, and perspective at the boundary.

That conditioning is why inpainting behaves so differently from a whole-frame edit. The model is not deciding what the picture is about, it is solving a much smaller problem: what would plausibly occupy this hole, given everything around it. Small problems have better answers.

The mask is most of the work

Nearly every bad inpainting result is a mask problem wearing a prompt problem's clothes.

  • Mask larger than the object. A tight outline tells the model the object's exact silhouette, which it will helpfully preserve by inventing something of the same shape.
  • Include the evidence. Shadows, reflections, and contact points are what convince the model the object existed. Remove a lamp but leave its cast light and something lamp-shaped comes back.
  • Feather the edge. A hard mask edge creates a visible seam. A few pixels of falloff lets the blend land inside the transition.
  • One object per pass. Two unrelated regions in one mask makes the model try to relate them.
  • Do not mask across a strong structural line such as a horizon, table edge, or architectural corner, unless you include enough of it on both sides for the model to continue it correctly.

Choosing the right task

GoalTask
Remove or replace something inside the frameInpainting
Extend the frame outwardOutpainting
Change the look of the whole pictureImage to image
Cut a subject out for compositingMatting and rotoscoping
Make a small image largerUpscaling

Reach for the narrowest task that solves the problem. Running a whole-frame pass to fix one hand means re-rolling every part of the picture you already approved.

Prompting an inpaint

Describe what should be in the region, not what you want gone. The model has no concept of removal; a removal is just an inpaint whose prompt describes background.

  • empty wet asphalt continuing the road markings, same overcast light
  • ⚠️ remove the car sometimes works, but it leaves the model guessing what replaces it

Two more habits. Keep the prompt short, because a long prompt inside a small mask encourages the model to cram a whole scene into a patch. And when a fill is nearly right, rerun with a different seed before rewriting the prompt: variance inside a small mask is usually cheaper than reasoning about wording.

Video inpainting

Video inpainting extends the same idea across time, and it is the standard method for wire removal, rig removal, sign replacement, and taking a modern object out of a period shot. Two things change. The mask has to travel with the object, which means tracking rather than drawing, and the fill has to stay consistent frame to frame, which means the model needs to reference neighboring frames rather than solve each one alone.

It works best when the region behind the object is revealed elsewhere in the shot, because then the fill is reconstruction rather than invention. A locked-off camera with a moving subject is the easy case. A static object in front of a static background, never revealed, is the hard one, and it is where the patch tends to breathe.

Models that support this

Pulled from the live ZOOOP model catalog, so this list stays current as new models ship.

  • Eraser
  • Inpaint

The prompt for this

A starting point that reliably produces the effect. Adjust the subject and setting; keep the technical clauses.

Empty wet asphalt continuing the road markings, same overcast light and reflections as the surrounding street

Try Inpainting yourself

Open the generator with a starting point already filled in.

Frequently asked questions

What is inpainting, in one sentence?
It is generation confined to a region you select, so the model rewrites only what is inside your mask and every pixel outside stays exactly as it was. That containment is the whole value, because it makes an edit reviewable instead of a new lottery ticket.
What is the difference between inpainting and outpainting?
Inpainting fills a hole inside the existing frame. Outpainting extends the frame beyond its original edges, inventing new canvas. Both are masked generation, but outpainting has real content on only one side of the mask, which is why it drifts further from the source.
Why does the object I removed leave a ghost or come back?
Almost always because the mask was too tight. The model can still see the object's shadow, reflection, and the way it occluded things behind it, so it reconstructs something to justify those cues. Extend the mask over the shadow and contact points and it disappears.
How large should the mask be?
Larger than the thing you are changing, with a soft edge. Give the model room to blend, and include whatever the object affected: shadow, reflection, spill light. Very small masks also fail in a different way, by giving the model too little context to match texture.
Does inpainting work on video?
Video inpainting exists and works well for removing static objects like a rig, a wire, or a sign. It needs a mask that follows the object across frames, so it is usually paired with a tracker. Moving subjects and changing occlusion remain the hard cases.
Why does the patched area look different from the rest of the photo?
Three usual mismatches: grain, because the fill is clean and the photo is not; sharpness, because the patch was generated at a different effective resolution; and perspective, because the model does not know your lens. Match grain and sharpness after the fact, and keep masks small enough that perspective cues stay local.

Related terms