Nodes/Comfyui-EasyIllustrious/▶ VAE Encode (Illustrious)
ComfyUI Node

▶ VAE Encode (Illustrious)

The node that turns on inpainting and regional prompting

By regiellis·Created 12 months ago·Updated 4 months ago· 82
▶ VAE Encode (Illustrious)
  • pixels
  • vae
  • mask
  • reference_image
  • latent
  • encode_info
modestandard
illustrious_versionauto
optimization_modeauto
enable_tilingtrue
tile_size512
overlap64
prepare_for_illustrioustrue
enhance_for_animetrue
mask_blur4
mask_dilate2

A plain VAE Encode does one thing: turn pixels into a latent so you can img2img them. This one does that plus the two things people actually build around it in an Illustrious workflow - inpainting and regional prompting - by way of a mode switch instead of three separate nodes.

What it's for

If you've read the pack's own docs, you'll know it draws a hard line between two techniques people constantly mix up: inpainting fixes a masked patch of an existing image, regional prompting puts different prompts in different areas of a fresh generation. This node is where inpainting starts. Set mode to inpaint, feed it a mask, and everything downstream (the sampler) only touches the masked area. Set it to regional and it just forwards your mask for the real work to happen in IllustriousRegionalConditioning - the encode itself doesn't need anything special for that path, which is worth knowing because it's easy to assume "regional" mode does more than it does.

How it works

Standard mode is a normal VAE encode with some Illustrious-flavored preprocessing bolted on: prepare_for_illustrious and enhance_for_anime are light tweaks applied before the encode, both on by default. Inpaint mode adds a mask (white = the area that changes) and an optional reference_image to pre-fill the masked region before sampling starts, instead of leaving it as noise - handy when you want the fix to lean on existing content rather than invent from scratch. mask_blur and mask_dilate feather and grow the mask before it's used: dilate first to cover a little more than you painted, then blur to soften the edge, which is the standard fix for the hard-seam look that untreated masks produce.

Large images get tiled through the VAE (enable_tiling, tile_size, overlap) so you don't blow your VRAM budget encoding a big canvas in one shot - optimization_mode picks a tiling strategy (quality/speed/memory) for you if you don't want to hand-tune tile size yourself.

The inputs and outputs that matter

  • pixels and vae - required, exactly what you'd expect.
  • mode - standard / inpaint / regional. This is the one setting that changes what the rest of your graph needs to look like.
  • mask and reference_image - only matter in inpaint mode.
  • mask_blur / mask_dilate - feathering, default 4px blur and 2px dilate. Raise blur if you're seeing a visible ring around the fixed area.

Output is latent (feed your sampler) plus encode_info, a diagnostic string - useful if something's not encoding the way you expect, not something you normally wire anywhere.

Installing it

Through ComfyUI Manager: search "EasyIllustrious," install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/regiellis/ComfyUI-EasyIllustrious
pip install -r ComfyUI-EasyIllustrious/requirements.txt

Then restart ComfyUI. No model downloads - this node works with whatever VAE your checkpoint already carries.

Common issues

Leave VAE on standard unless you're actually inpainting. The pack's own docs are explicit about this: regional prompting doesn't need regional mode here at all - that mode exists to forward mask data for a different node's benefit, and using it when you don't need to just adds a variable to debug.

Visible seam around an inpainted patch. Raise mask_blur before you touch anything else - this is the single most common inpainting complaint and it's almost always an under-feathered mask, not a model problem. If the fix still looks tonally off from its surroundings, that's what reference_image is for: pre-fill from something closer to the target look instead of pure noise.

VRAM errors on big images. Make sure enable_tiling is on (it is by default) and drop tile_size before you drop your resolution.

CategoryEasy Illustrious / VAE

Inputs (14)

NameTypeDefaultDescription
pixelsIMAGEImages to encode into latents.
vaeVAEVariational Autoencoder used to encode images.
modeoptCOMBOstandardEncoding mode. Inpaint uses a mask and optional reference image; Regional forwards mask for downstream guidance.
illustrious_versionoptCOMBOautoAuto-detect from image size; choose specific to nudge prep.
optimization_modeoptCOMBOautoAdjusts tile size and memory strategy.
enable_tilingoptBOOLEANtrueEnable for large images to avoid VRAM issues.
tile_sizeoptINT512256–1024Encode tile size in image pixels.
overlapoptINT6432–128Overlap between tiles to hide seams.
prepare_for_illustriousoptBOOLEANtrueApply minor tweaks before encode for Illustrious.
enhance_for_animeoptBOOLEANtrueLight enhancement that suits anime/illustration.
maskoptMASKWhite = region to affect. Will be downscaled to latent size and used as noise mask.
reference_imageoptIMAGEOptional reference image to fill masked area prior to sampling (inpaint mode).
mask_bluroptINT40–64Feather mask edges (pixels).
mask_dilateoptINT20–64Grow mask (pixels) before blur.

Outputs (2)

NameTypeDescription
latentLATENT
encode_infoSTRING