Paintbrushes loaded with red and orange paint working a small area of a finished canvas, the physical equivalent of masking one region of a rendered image and repainting only that

Repaint the corner that's wrong. Leave the rest of the canvas alone.

Inpainting: Fixing One Part Of An Image Without Losing The Rest

The two-node fork that decides whether a repair blends or blows up

Published August 3, 2026 · RealAIGirls · About an 8 minute read

Share on X Share on Facebook Share on Reddit

Render 47 is the one. Pose, light, wardrobe, background, expression, all of it finally landed together. Then you look at the left hand and it has five and a half fingers. Hitting generate again gives you a different picture, because that seed produced that pose and that light along with that hand, and there is no version of rolling the dice that keeps the good parts. Inpainting is the answer to exactly this, and the reason so many people bounce off it is that ComfyUI offers two nodes for the job that look interchangeable and are not.

Everything below assumes the image already exists. If the problem is that the face drifts between renders, that is a different tool, covered in the IPAdapter FaceID and InstantID guide. If the problem is that the whole image is soft at full resolution, that is the two-pass upscale piece. This one is for when 95 percent of the frame is finished and one region needs surgery.

Start With The Right Checkpoint

ComfyUI's own inpainting tutorial does not use a general-purpose model. It has you download 512-inpainting-ema.safetensors and drop it into ComfyUI/models/checkpoints, and the documentation is direct about why: that model is specifically designed for inpainting, which helps better control the generation area. The docs run the same workflow against a standard checkpoint, v1-5-pruned-emaonly-fp16.safetensors, for comparison, and describe the inpainting model as producing better inpainting effects and more natural transitions.

You can inpaint with a regular checkpoint. It works. It just spends more of your attention on hiding the seam, and the seam is the whole difficulty of the technique.

Painting The Mask Without Leaving ComfyUI

The mask is the instruction. Everything under white gets regenerated, everything else stays. ComfyUI has a built-in editor, and the click path in the official tutorial is worth memorizing because it is not discoverable:

That copy-to-clipspace step is what lets you fix an output without ever writing it to disk and reloading it, which matters more than it sounds like when you are doing six passes on the same frame.

The Fork That Decides Everything

Here is the part that costs people an evening. ComfyUI ships two ways to hand a masked latent to the sampler, and they behave in opposite ways.

NodeDenoise it expectsWhat it is for
VAE Encode (for Inpainting)1.0, full denoiseTrue inpainting. Replace the masked content outright. Best with an inpainting checkpoint, works with any model.
Set Latent Noise MaskLower, roughly 0.6 to 0.8Image-to-image restricted to the masked region. Keeps the underlying structure and nudges it.

The guidance from ComfyUI's own maintainer is unambiguous: VAE Encode (for Inpainting) should be run at 100 percent denoise, and if what you want is img2img on a masked part of the image, use Set Latent Noise Mask instead so a lower denoise actually does something. Feed a low denoise into the first node and the result tends to come back mushy or unchanged, and it reads like the node is broken. It is not broken. It was asked to do the other job.

Pick the node by intent, not by habit. Replacing a hand, deleting an object, swapping a background element: that is VAE Encode (for Inpainting) at denoise 1.0. Softening a harsh shadow, adjusting a fabric fold, cleaning up a smear while keeping the shape underneath: that is Set Latent Noise Mask at a lower denoise. Choosing by what you want the pixels to end up as saves more time than any sampler tweak.

grow_mask_by Is The Seam Control

The VAE Encode (for Inpainting) node takes four inputs: pixels, vae, mask, and grow_mask_by. The first three are plumbing. The fourth is the one that changes results. ComfyUI describes it as a pixel value that expands the original mask outward, which creates a smoother transition between regenerated content and untouched content. A mask painted tight to the edge of a hand gives the model almost no surrounding context to blend into, and you get a visible outline where the repair stops. Growing it out gives the sampler room to negotiate the boundary.

Outpainting Is The Same Trick Wearing A Different Hat

Extending a frame past its original borders uses the identical machinery. ComfyUI's outpainting workflow says so plainly: this is actually an inpaint workflow, and only the way the mask gets built is different. The Pad Image for outpainting node takes an image and outputs an extended image plus the matching mask, with left, top, right, and bottom controlling how far the canvas grows in each direction, and feathering controlling the smoothness of the transition between the original image and the added padding. Same checkpoint, 512-inpainting-ema.safetensors, same sampler, same idea. You paint a mask, the model fills it.

When Not To Bother

An honest limit: inpainting is a repair tool, and repair only pays off when the thing underneath is worth repairing. If the composition is wrong, if the pose reads awkward, if the lighting direction fights the background, no amount of masked regeneration fixes that, and you will burn forty minutes proving it. Reroll the seed. Inpainting earns its keep on a frame you already love that has one specific, local, identifiable flaw, and it gets worse the more of the picture you ask it to redo. A mask covering half the canvas is not an inpaint. It is a slower way to generate a new image.

Get the checkpoint right, get the mask edge generous, and get the node choice matched to the intent. Those three decisions account for nearly every inpaint that lands cleanly, and nearly every one that does not.