Nodes/ComfyUI-RookieUI/RookieUI VAE Encode (A1111 Inpaint)
ComfyUI Node

RookieUI VAE Encode (A1111 Inpaint)

A1111's masked-content fill modes as a ComfyUI node

By rookiestar28·Created 4 months ago·Updated 30 days ago· 89
RookieUI VAE Encode (A1111 Inpaint)
  • pixels
  • vae
  • mask
  • LATENT
grow_mask_by6
masked_content
seed0
soft_inpainting_enabledfalse
soft_inpainting_schedule_bias1.00
soft_inpainting_preservation_strength0.50
soft_inpainting_transition_contrast_boost4.00
soft_inpainting_mask_influence0.00
soft_inpainting_difference_threshold0.50
soft_inpainting_difference_contrast2.00

When you inpaint in Automatic1111, one of the quiet-but-important choices is "Masked content" - fill, original, latent noise, or latent nothing - which decides what sits under the mask before denoising starts. It's the difference between removing an object cleanly and having the model regenerate what was already there. ComfyUI's stock inpaint encode doesn't expose those modes the same way. This node does. It's the encode step of RookieUI's A1111-style inpaint path: it turns your image, VAE and mask into a LATENT ready for the sampler, with the WebUI's fill semantics baked in.

How it works

You hand it pixels (the image), a vae, and a mask. It grows the mask a little, fills the masked region according to your chosen mode, encodes the whole thing to latent space, and outputs a LATENT. That latent goes into your KSampler, and the actual strength of the change is set by the sampler's denoise - this node prepares the canvas; the sampler decides how far from it to travel.

The mask usually comes from RookieUILoadAssetMask (a mask you painted in the sidebar) or from RookieUIADetailerDetectMask (an auto-detected region). Downstream, composite the result back so only the masked pixels change - that's the one inpainting rule everybody eventually learns the hard way.

The inputs that matter

  • masked_content (fill / original / latent_noise / latent_nothing) - the A1111 fill mode, and the input you'll actually think about. Use original for subtle changes (start from what's there), fill for removing objects (blurred average of surrounding colors), and latent_noise when you want genuinely new content in the region. latent_nothing is rarely the right call.
  • grow_mask_by (0–64, default 6) - expands the mask outward before encoding, so the fix has room to blend instead of ending in a hard seam. This is your mask-padding dial.
  • mask - the region to regenerate. Everything outside it is treated as fixed context.

Then there's the soft-inpainting block. soft_inpainting_enabled (default off) turns on A1111's soft-inpainting mode, which blends the generated region into the original more gradually along the mask edge - good for skin and gradients where a hard mask boundary shows. When it's off, the seven soft_inpainting_* parameters (schedule bias, preservation strength, transition contrast, mask influence, and the difference thresholds) do nothing, so leave them at defaults until you flip the toggle. If you do enable it, soft_inpainting_preservation_strength is the one to nudge first - higher keeps more of the original. There's also a seed input used when the fill mode needs noise.

How to install it

Via ComfyUI Manager: search ComfyUI-RookieUI, install, restart. Manually, from your ComfyUI root:

cd ComfyUI/custom_nodes
git clone https://github.com/rookiestar28/ComfyUI-RookieUI
cd ComfyUI-RookieUI
python -m pip install -r requirements.txt

Then restart ComfyUI.

Common issues

The classic mistake isn't on this node at all - it's setting denoise too high on the sampler for a small fix, which regenerates the entire masked region instead of nudging it. For a detail repair, keep the sampler's denoise low (0.3–0.4) and let masked_content: original carry the existing pixels; crank denoise and switch to latent_noise only when you actually want new content.

If you're getting a visible box or color mismatch around the fix, raise grow_mask_by and make sure the VAE feeding this node matches your checkpoint - a wrong VAE on the encode/decode cycle is a common source of grey-box artifacts. And whatever you do, composite the masked region back over the original afterward rather than letting the full frame ride through the VAE; chaining several uncomposited inpaint passes degrades the whole image fast.

CategoryRookieUI/latent

Inputs (13)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
maskMASK
grow_mask_byINT60–64
masked_contentCOMBO4 options: fill, original, latent_noise, latent_nothing
seedINT00–18446744073709550000
soft_inpainting_enabledBOOLEANfalse
soft_inpainting_schedule_biasFLOAT1.000–8
soft_inpainting_preservation_strengthFLOAT0.500–8
soft_inpainting_transition_contrast_boostFLOAT4.001–32
soft_inpainting_mask_influenceFLOAT0.000–1
soft_inpainting_difference_thresholdFLOAT0.500–8
soft_inpainting_difference_contrastFLOAT2.000–8

Outputs (1)

NameTypeDescription
LATENTLATENT