AI images

How to Inpaint: Edit One Part of an Image

3 min read

Inpainting regenerates a masked region of an existing image and leaves every pixel outside the mask untouched. It is how you remove an object, fix a hand, or swap a background detail without redrawing the whole picture.

1. Open the image in a tool that masks

2. Mask slightly larger than the object

Midjourney’s own guidance is that selection size matters: a bigger selection gives the model more surrounding context to match, while too large a selection lets it replace things you wanted kept. Start a little wider than the object’s edge — tight masks leave a visible seam.

3. Prompt for the masked area only

Clear blue sky with thin high cloud, matching the warm afternoon light in the rest of the photo.

What it does: describes what belongs inside the mask plus the lighting to match. Describing the whole scene makes the model drift outside the selection.

For removal, describe the background that should be there rather than the removal itself — “empty grass field, matching lighting” works where “remove this” does not. In Midjourney, editing the prompt inside the Vary (Region) editor requires Remix Mode turned on.

If it fails

A pasted-in look almost always means the mask edge, not the prompt. Run a second small inpaint pass over just the seam, or redo the mask with a softer, wider edge. If the model keeps changing things outside the selection, your prompt is describing the whole image.

This is a diffusion model working from noise, so the same mask and prompt give a different result each run — regenerate before you rewrite the prompt. Next: remove an image background with AI or build a first ComfyUI workflow for repeatable local edits.

Source: Midjourney Vary (Region) documentation.

Open the full interactive version (with copy buttons) ↗

← All guides