VAE Encode & Inpaint Conditioning
One node instead of two overlapping ones
- positive
- negative
- vae
- pixels
- mask
- positive
- negative
- latent inpaint
- latent samples
This one exists to fix a specific annoyance: ComfyUI's own VAE Encode (for Inpainting) and InpaintModelConditioning both do useful, slightly different things, and if you want both you end up VAE-encoding the same image twice. This node folds them into one pass - same result, half the encode overhead - and, more importantly, produces the one latent shape that Apply Fooocus Inpaint actually needs.
Why you'd reach for it
Plain VAE Encode (for Inpainting) is the simple path: it works fine with the Fooocus patch, but only at denoise 1.0. No existing content survives - the masked area is fully regenerated. That's fine for "replace this entirely" work, but no good if you want to refine what's already there.
InpaintModelConditioning is the node that lets you dial denoise down and keep some of the original content, but its output latent isn't compatible with Apply Fooocus Inpaint directly. This node bridges that gap: it gives you the InpaintModelConditioning-style latent that supports partial denoise, in a form the Fooocus patch node can actually consume. If you've ever wondered why your Fooocus inpaint workflow ignores your denoise slider, this is almost certainly the missing piece.
Inputs and outputs
Inputs are what you'd expect for a combined VAE-encode-plus-conditioning step: positive and negative conditioning, your vae, the source pixels (image), and the mask.
It gives you four outputs, and the two conditioning ones pass straight through unchanged:
- positive / negative - forwarded conditioning, wire to your KSampler as usual.
- latent inpaint - feed this into Apply Fooocus Inpaint's
latentinput. This is the one that makes partial-denoise refinement work with the Fooocus patch. - latent samples - feed this into your KSampler's
latent_imageinput.
Both latents come from the same single encode pass, which is the whole point of the node.
Installing it
It ships in the same pack as every other node here - ComfyUI Manager (search "ComfyUI Inpaint Nodes") or:
cd ComfyUI/custom_nodes
git clone https://github.com/Acly/comfyui-inpaint-nodes.git
Restart ComfyUI afterward. No extra model download for this specific node - the model requirement is on Apply Fooocus Inpaint downstream, not here.
Common issues
Wiring the wrong latent into the wrong node is the mistake this node exists to prevent, but it's still possible to cross the wires - latent inpaint goes to Apply Fooocus Inpaint, latent samples goes to KSampler. If your KSampler complains about latent shape or your denoise seems to do nothing, check you haven't swapped them.
This isn't a substitute for compositing. Like every masked-inpainting workflow, the community's standing rule still applies here: paste the generated region back over the original with something like ImageCompositeMasked after sampling rather than letting the full decoded frame stand as your output, especially if you're chaining multiple inpaint passes - repeated VAE round-trips will drift color and detail in regions you never touched.
There's an official example. The pack ships a reference workflow at workflows/inpaint-refine.json in the repo that wires this node up correctly end to end - worth pulling up side-by-side the first time you build this yourself.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| positive | CONDITIONING | — | |
| negative | CONDITIONING | — | |
| vae | VAE | — | |
| pixels | IMAGE | — | |
| mask | MASK | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| positive | CONDITIONING | — |
| negative | CONDITIONING | — |
| latent inpaint | LATENT | — |
| latent samples | LATENT | — |