Nodes/Comfyui-ergouzi-Nodes/2🐕Redraw encoder
ComfyUI Node

2🐕Redraw encoder

The pack's VAE-Encode-for-Inpaint, with a fill-mode switch

By 11dogzi·Created 2 years ago·Updated 2 years ago· 102
2🐕Redraw encoder
  • pixels
  • vae
  • mask
  • LATENT
grow_mask_by6
use_original_image

Strip away the name and this is functionally ComfyUI's own "VAE Encode (for Inpainting)" node: same shape of inputs, same job, same output. What ergouzi's version adds is a fill-mode switch - a choice most stock workflows leave you to bolt on yourself with extra nodes if you want it at all. If you're building a local-redraw (inpaint) workflow inside this pack, this is the node that turns your image and mask into the latent your sampler actually runs on.

How it works

You're VAE-encoding an image into a latent the way any encoder does, but doing it "for inpainting" - the mask gets baked into that latent so the sampler knows exactly which region it's allowed to touch, and the mask's edge is grown by grow_mask_by pixels first so the eventual fix has room to blend rather than stopping at a hard line.

use_original_image is the part worth understanding before you flip it. Set to original, the masked pixels going into the encode are the image's actual existing content - the sampler is nudging something that's already close to right, which is what you want for subtle corrections. Set to filling, those pixels get replaced with a blurred average of the surrounding area first, so there's nothing of the old content left to lean on - better when you actually want to remove or replace what's there rather than touch it up. It's the same original-vs-fill choice that shows up as "masked content" in other inpainting UIs, just distilled to the two options that matter most.

The inputs and outputs that matter

  • pixels (IMAGE, required) - the image to encode.
  • vae (VAE, required) - must match the model you're about to sample with.
  • mask (MASK, required) - where the sampler is allowed to change things.
  • grow_mask_by (INT, 0-64, default 6) - padding added to the mask edge before encoding.
  • use_original_image (enum: original / filling) - what fills the masked pixels going into the encode.

Output is a single LATENT - feed it straight into a KSampler along with your model and conditioning.

How to install it

Search Comfyui-ergouzi-Nodes in ComfyUI Manager, or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/11dogzi/Comfyui-ergouzi-Nodes.git

Restart ComfyUI. As with the rest of this pack, the README marks this English repo as frozen - ongoing development lives on a Chinese-named sibling repo instead.

Common issues & troubleshooting

Visible ring right at the mask boundary. The default grow_mask_by of 6 is fairly conservative. The wider guidance for detail fixes (faces, hands, anything you want blended cleanly) runs 32-64 pixels of padding - if you're seeing a seam, raise this before you start tweaking denoise strength to compensate for it.

Picked "filling" and got a totally different result than expected. That's the mode working as intended - filling deliberately erases what was there so the model has nothing old to anchor to, which means it's going to invent more than "original" would. If you wanted a light touch-up rather than a fresh regeneration in that region, switch back to original.

Whole image looks slightly off after decoding, not just the masked area. This node bakes the mask into the latent, but it doesn't composite the result back for you afterward. Decode, then paste only the masked pixels over your original image with a mask-composite step - don't trust the raw decode for the whole frame. Skipping that compositing step is one of the most common ways a local repair ends up degrading parts of the image nobody touched, and it's exactly the pattern this pack's own crop-then-stitch refinement nodes are built to avoid.

Category2🐕/🤿Latent

Inputs (5)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
maskMASK
grow_mask_byINT60–64
use_original_imageCOMBO2 options: original, filling

Outputs (1)

NameTypeDescription
LATENTLATENT