π¨βπ¨ Inpaint
Four inpaint nodes folded into one
- pixels
- vae
- mask
- positive
- negative
- positive
- negative
- latent
Inpainting in vanilla ComfyUI is annoying because the "right" way to set up the latent depends on what you're doing, and there are four different nodes for it: VAE Encode, VAE Encode (for Inpainting), Set Latent Noise Mask, and InpaintModelConditioning. Pick the wrong one and you get seams, color shifts, or a masked region that ignores your prompt. This node collapses all four into one and picks the correct behavior for you based on which inputs you wire and one toggle. That's the entire value proposition, and it's a good one - it removes the most common way people set inpainting up wrong.
Inpainting itself is still the tool for one specific thing in 2026: changing part of an image while leaving the rest bit-for-bit identical. Instruction-edit models (Kontext, Qwen-Image-Edit) have taken over most "change this" work, but they re-emit the whole frame, so unmasked areas drift. A mask is how you regenerate a region and composite it back with nothing else touched.
How it works
The node encodes your pixels to a latent with the vae, and then, depending on the inputs, mimics one of the four stock nodes:
- No
maskβ plain VAE Encode. It just encodes the image (a straight img2img latent). - No
positive/negativeconditioning β VAE Encode (for Inpainting), the standard path for a regular checkpoint: it prepares the masked latent so an ordinary model regenerates inside the mask. - Conditioning wired,
SetLatentNoiseMask= True β Set Latent Noise Mask behavior: keeps the original latent and masks only the noise, which is what you want for partial-denoise touch-ups where the underlying content should still influence the result. - Conditioning wired,
SetLatentNoiseMask= False β InpaintModelConditioning: the proper path for a dedicated inpaint/fill model (like a Flux Fill or an SDXL inpainting checkpoint), where the mask is baked into the conditioning. This is why the node outputs conditioning, not just a latent.
The inputs and outputs that matter
pixels- the image you're inpainting.vae- needed to encode to latent space. Use the VAE that matches your model.mask(optional) - the region to regenerate. No mask turns this into a plain encode.positive/negative(optional) - your conditioning. Wire these when you're using a real inpaint/fill model so the node routes through the conditioning-aware paths.SetLatentNoiseMask- the key toggle. True for partial-denoise edits on a normal model; False to hand a dedicated inpaint model properly-conditioned inputs.
Outputs: positive, negative, and latent - wire all three straight into your KSampler.
How to install it
ComfyUI Manager: search SDVN_Comfy_node, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableDiffusionVN/SDVN_Comfy_node
then pip install -r custom_nodes/SDVN_Comfy_node/requirements.txt from your ComfyUI root, and restart. It's under the SDVN menu.
Common issues & troubleshooting
The masked area comes out as a smeary blob ignoring the prompt. Usually a model/mode mismatch. If you're on a regular checkpoint, leave conditioning off (or set SetLatentNoiseMask True) and control the change with denoise. If you wired a fill model, set SetLatentNoiseMask False so it goes through the conditioning path it needs.
Visible seams or color mismatch at the mask edge. That's inherent to whole-image inpainting on a non-inpaint model. Feather the mask, lower the denoise, or - for a small region - crop the masked area, inpaint at full resolution, and stitch it back. A 64px eye deserves 1024px of generation budget, and cropping is how it gets it.
Everything inside the mask regenerates from scratch even at low denoise. You want SetLatentNoiseMask = True for that. With it False on a normal model, the masked latent is wiped, so the region ignores its original content regardless of denoise.
Wrong VAE. Feeding an SDXL VAE for an SD1.5 model (or vice versa) produces washed-out or garbled latents. Match the VAE to the model.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| SetLatentNoiseMask | BOOLEAN | β | |
| pixels | IMAGE | β | |
| vae | VAE | β | |
| maskopt | MASK | β | |
| positiveopt | CONDITIONING | β | |
| negativeopt | CONDITIONING | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | β |
| negative | CONDITIONING | β |
| latent | LATENT | β |