Skip to Content

Inpainting, Outpainting and Background Replacement

Three operations you used to pay a retoucher an afternoon for. All three rest on one single idea, and once you have that idea you can use all three.
September 12, 2026 by
Inpainting, Outpainting and Background Replacement
Krisztian Eyssen, Krisztian Eyssen

Three operations, one idea

Here is the shared foundation: you select a part of the image and have only that part regenerated, leaving the rest untouched. The model sees the edges of what remains and matches whatever it draws into the selection to them — which is why the light, the shadow and the perspective line up.

The three names only tell you where the selection sits. Inpainting is inside the picture, outpainting is beyond its edges, background replacement is around the main subject. Everything else — how you write the prompt, the kind of errors you get, how you fix them — is the same.

Inpainting: making a blemish disappear

This is the most common case: a bin in the holiday photo, a cable on the façade, a guest nobody asked for. You circle it and say what should be there instead. The good phrasing here is not "take the bin out" but what should take its place: "continuing kerb and wall".

That is not a detail. If you only ask for removal, the model has to invent what was behind it on its own, and sometimes it invents something that fits but does not belong — a door, a bush, a shadow. When you say what to continue, the hit rate jumps.

Outpainting: extending the frame

Here the selection sits outside the edge of the image: the model gets the existing picture and generates around it. There are two reasons people reach for this. One is changing the aspect ratio — a portrait phone photo into a landscape cover image — and the other is that the text needs room.

The second one is worth building into your workflow. Instead of begging for empty space at generation time, you shoot tight and then extend on the side where the caption will go. Space won that way stays reliably empty, unlike whatever the model leaves of its own accord.

Background replacement: harder than it looks

In principle background replacement is just masking: you cut the subject out and put something else behind it. The trap is not the cut-out, it is the light. If the subject was shot lit from the side and the background is lit head-on, the picture will look fake without you being able to say why.

So a good background-replacement prompt always includes a description of the light, matched to the original photo rather than to whatever would look nice. The other frequent mistake is the shadow: if there was a shadow under the subject and the new background has none, the subject will float. Most modern tools can generate a shadow, but you have to ask.

The mask decides the result

The prompt matters, but the quality of the mask matters at least as much. Four things improve it more than anything else.

  • Make it generously larger than the object you are removing. Draw it tight and the model will often leave the object's outline or its shadow behind.
  • Cover the shadow too. This is the part people forget most often, and it is the biggest giveaway that something was done to the picture.
  • Soften the edge where the surroundings are soft (sky, skin, carpet), and keep it hard where they are hard (the edge of a table, a building).
  • One mask, one request. Do two different fixes in two separate rounds rather than together — that way you can redo the one that went wrong on its own.

A recipe for background replacement

For product shots this order produces the fewest fake-looking results.

1. Select the product, and let the mask hang 10-15 pixels below its base.
2. In the prompt describe the background AND the light, matched to the original:
   "light oak table, blurred workshop wall behind it,
    soft light from the left, as in the original photo"
3. Ask for the contact shadow in a separate sentence:
   "soft contact shadow under the object, matching the light direction"
4. Check the reflections: if the product has metal or glass on it,
   the old background's colour shows there. That needs fixing separately.

Common misconceptions

  • "You need a paid tool for these." Of the three, inpainting and outpainting are available in most free image editors, and open tools handle them well too.
  • "Precision of the mask is what counts." The opposite: too tight a mask is the single most common source of trouble. The model needs room to blend the edge in.
  • "At high resolution the patch will be finer too." Most tools generate the selected area at a fixed size and then scale it back. On a large image a small patch therefore often ends up softer than its surroundings.
  • "Background replacement is the same as background removal." It is not. Removal cuts out; replacement also redraws the band around the subject — and that can change the subject's edge as well.

What to take away

These three operations are the most reliable AI part of image editing, because they do not touch the rest of the picture — no drift, no surprises. Whenever the job can be circled, this beats regenerating the whole image; the free-text alternative is the subject of conversational editing, which is a separate post. With products these three operations form the backbone of the workflow that product photography for a webshop walks through step by step.

Inpainting, Outpainting and Background Replacement
Krisztian Eyssen, Krisztian Eyssen September 12, 2026
Share this post
Archive