The first time it works, it feels like a magic trick. You open a photo of a friend on a beach, paint over a stranger drifting into the left edge of the frame, type empty sand, small waves, and hit generate. Three seconds later the shoulder is gone and the shoreline looks like it always belonged to your friend. Same grain, same light, same slightly crooked horizon.
That is AI image inpainting at its most basic: select a region, describe what belongs there, let a model draw it. The interesting part is everything around that sentence. The mask you drew, the words you typed, the resolution you’re working at. Get those right and nobody can tell. Get them wrong and the edit looks like a smudge that has been cleverly disguised as a smudge.
What inpainting is actually doing
Every inpainting tool runs the same two-step process. It discards the pixels inside your mask, then generates replacements that fit the hole. The model draws on two inputs: patterns learned from training data, and whatever it can see immediately outside the selection.
That second input decides most of the outcome. A tight mask with almost no surrounding context leaves the model guessing, and guesses look generic. Give it the whole wall, the corner of a window frame, the shadow falling across the floor, and it has texture, colour temperature and perspective lines to match against. Most consumer tools quietly crop a border of surrounding pixels to help themselves, but the wider your selection, the more reliable the fill.
What inpainting cannot do is recover information that was never captured. Blown-out highlights, heavy motion blur, a face turned fully away from the lens. A model will happily paint a plausible replacement, but it is inventing, not restoring. Knowing which side of that line you’re standing on saves entire afternoons.
The three kinds of tool, roughly sorted
- Desktop editors. Photoshop’s Generative Fill is still the reference point for photographers. Fast, comfortable with large masks, and the result lands in a layered file you can keep adjusting.
- Browser editors. Cheap or free, no install, and surprisingly good at object removal and product clean-up. Fine control over tiny details is where they fall short. Our look at what an online AI image editor really fixes covers the trade-offs honestly.
- Open models you run yourself. Stable Diffusion inpainting checkpoints and FLUX Fill offer the most control: custom masks, negative prompts, locked seeds, batch repeats. The FLUX image generator is a good example of the breed, strong on texture and light, occasionally confused by hands.
Patch a photo twice a year and a browser tool is plenty. Inpaint for money and the local route earns its setup time back within a week of repeatable results.
Masking decides the result before the model does
Four habits separate clean fills from visible ones.
- Overshoot the object by a few pixels. Masks that clip the edge of what you’re removing leave a thin ghost outline the model can’t resolve.
- Split big edits into passes. Removing a car plus its shadow plus a road sign in one go gives the model three problems at once. Do them one at a time.
- Stay off hard edges. If your mask crosses a doorway, a shelf line or a shirt collar, expect a wobble there. Reshape the selection to end inside a uniform region.
- Feather slightly. Two or three pixels of softness, no more. Heavy feathering smears the original pixels inward and produces a halo.
Prompting the hole
Describe the fill, not the deletion
Remove the bin is a weak instruction. Grey pavement slabs, soft afternoon shadow is a strong one. The model has no concept of absence. Tell it what to draw.
Borrow the lighting words from the photograph
If the scene is backlit, say backlit. If it is overcast, say flat overcast light. Two or three words about direction and quality of light do more than a paragraph of adjectives about objects. The same principle that governs full-frame generation applies here, and the guide to getting better results from text to image AI is worth reading with masking in mind.
Keep prompts short and specific
Long prompts drift. Two subjects in a fill request almost always produces muddled geometry. Name one material, one colour, one lighting condition, and stop typing.
Where inpainting still falls apart
Hands, for one. Fingers are the classic failure, and they fail in inpainting for the same reason they fail everywhere else.
Text is worse. Any fill that needs to produce a logo, a sign, a label or a serial number will produce letter-shaped nonsense. If a photo needs readable words, composite real ones instead.
Repeating patterns are a subtler problem. Brickwork, hedges, tiled floors, chain-link fences. Models tend to produce tiling artefacts, a visible rhythm that repeats every few hundred pixels. Zoom out and it reads as a texture. Zoom in and it reads as wallpaper.
Straight architectural lines are the last big one. Any fill crossing a window frame, a ceiling grid or a handrail needs to continue a vanishing point exactly. If a first pass doesn’t, mask tighter around the line and describe it explicitly.
Inpainting, outpainting and object removal are three different jobs
People use the terms interchangeably, which leads to expecting the wrong thing from the tool.
Inpainting works inside the frame, filling a hole that already exists. Object removal is a subset of it, aimed at making something disappear without leaving evidence, and the technique is worth learning properly because a bad erase screams louder than a bad fill. There’s a solid walkthrough on erasing objects from a photo without it looking edited that covers the mask shapes that work.
Outpainting pushes the boundary outward, extending a crop rather than filling a gap. Different mask, different prompt logic, and often a wider source image. If extending the frame is the actual goal, read about extending a photo beyond its original frame before you start painting.
Jobs where it genuinely earns its keep
Real-estate photography is the obvious one: cables, wheelie bins, a landlord’s laundry basket on the balcony. Product shots come second. A watch strap with a scratch, a sneaker with a scuff, a bottle reflecting the photographer’s arm. Colour changes on clothing run a close third, and inpainting handles them better than hue sliders because it redraws the fabric folds with the new colour.
Restoration work is the satisfying end of the scale. Scanned family prints with creases, dust and torn corners clean up remarkably well, provided you mask generously and ask for texture rather than smoothness. Ask for smooth and you’ll get plastic skin that matches nothing else in the frame.
A workflow that holds up
Duplicate the layer, always. Work at the image’s native resolution rather than upscaling first, because models handle a 4000-pixel file more gracefully than a 16000-pixel one and you avoid inventing detail you then have to match.
Mask generously, prompt briefly, generate three or four variations. Pick the closest, then run a second pass on the seams only, with the mask narrowed to the join between old and new pixels. That second pass fixes most of what people blame on the model.
The honest test is whether your eye stops at the edit. Zoom to 100%, look away from the screen for a second, look back. If your gaze lands on the patched stretch of wall, something is off, and it is usually one of two things: the mask was too small, or the prompt named an object without describing the light on it. Fix either and run it again. Two extra passes is normally the distance between looks fixed and is fixed.

