§12.03

How to Inpaint: Edit One Part of an Image

Inpainting masks a region and regenerates only that: Midjourney Vary (Region), Firefly Generative Fill, ChatGPT, or Stable Diffusion locally.

published 02 Sept 2026 updated 06 Sept 2026 checked against docs 06 Sept 2026 3 min in AI images Markdown

On this page4 sections
  1. 1. Open the image in a tool that masks
  2. 2. Mask slightly larger than the object
  3. 3. Prompt for the masked area only
  4. If it fails

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

  • Midjourney — upscale a result, then click Vary (Region) to open the editor. On midjourney.com the same inpainting tool is built into the Editor.
  • Adobe Firefly / Photoshop — Generative Fill: select an area, type a prompt.
  • ChatGPT — upload an image and ask for a specific change; it re-renders the region.
  • Stable Diffusion locally (ComfyUI, Automatic1111) — full control over mask, denoise strength and prompt. Best for repeated edits.

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.

← All AI images plates · Search all guides

↑↓ move↵ openalt+↵ copy first command

Keyboard

⌘/ctrl+K or /
Search all guides
alt+↵
In search: copy the guide's first command
j / k
Move through a list of guides
c
On a guide: copy its first command
t
Toggle light / dark
?
This list