Skip to content

Inpainting

The overall image looks great, but one corner is off — an extra finger, an unwanted bystander, a pattern that went sideways. Re-generating the whole image risks changing everything else; inpainting is the answer: you draw a boundary around “only this region can change,” and everything outside stays put.

The approach here follows the official tutorial — for a step-by-step version with screenshots, see ComfyUI Inpainting Workflow.

  1. Mask: tells the model “which area to repaint.” Usually white marks what to change, black marks what to preserve (verify with your specific workflow).
  2. Use an inpaint-oriented model: a checkpoint specifically trained for “hole-filling” blends edges much more naturally. Using a regular text-to-image model often produces hard seams or jarring style shifts.
  3. Different encoding: a normal workflow encodes an empty latent or the full image; inpainting typically uses a node like VAE Encoder (for Inpainting) to encode original image + mask together into latent space, so the sampler knows “what to preserve, what to regenerate.”

The official docs table worth remembering: pixels is the source image, mask defines the region, grow_mask_by expands the mask outward by a few pixels to create a transition zone at the seam — avoids a hard cut.

  • Fix flaws: remove unwanted objects, fix hands, fix faces.
  • Isolate details: change only the clothing texture, change only the expression — leave everything else untouched.
  • Some assets include an alpha channel — import it and you effectively have a built-in transparent region as your mask.
  • More often you’ll draw it yourself: right-click on Load Image, open Mask Editor, paint with a brush or erase, then save. The painted region feeds into the downstream encoding node. The Copy(Clipspace) / Paste(Clipspace) workflow shown in the official tutorial is for copying the previous output back in to continue editing — very handy.
  1. Load Checkpoint: is it an inpaint model (or one you’ve confirmed fits your workflow)?
  2. Load Image: is the image correct? Is the mask correct?
  3. Positive / negative prompts: be specific about “what you want this region to become.” Don’t expect the model to guess.
  4. KSampler: try multiple seeds — inpainting usually requires a few tries before it looks right.

The “painter revising a draft” logic from Introduction hasn’t changed — it’s still conditioning + sampling. The difference is: the starting point isn’t pure noise on a blank canvas — it’s “repainting with constraints applied to the original image.” Keep that in mind and you won’t get lost when switching nodes or workflows.