Nodes/OmniNodes/VAE Encode πŸ”’
ComfyUI Node

VAE Encode πŸ”’

The door from pixels to latent space (and why each trip costs a little)

By TensorVizionΒ·Created 3 months agoΒ·Updated about 8 hours agoΒ· 0
VAE Encode πŸ”’
  • pixels
  • vae
  • latent
  • summary

Most of the time you never see the VAE encoder - you generate from an empty latent and only decode at the end. But the moment you want img2img, inpainting, or any workflow that starts from an existing image, you need to get that image into latent space first. The VAE Encode node from TensorVizion/OmniNodes is that door: a thin wrapper around ComfyUI's core VAEEncode that compresses pixels into the latent representation the sampler works in, with a summary output added on top.

Mechanically it's the mirror image of the pack's VAE Decode - same delegation pattern, straight to core's encode() - so the behavior is identical to the stock node. Feed it pixels and a VAE, get a latent. The summary reports what you encoded, which is the pack's consistent habit: every wrapper here documents its own work.

Why you'd reach for it

The classic use is img2img. Encode your source image, feed the latent to a KSampler with denoise below 1.0, and the sampler restructures it toward your prompt instead of generating from pure noise. Lower denoise (0.3–0.6) keeps more of the original; that's how you restyle or refine instead of replace. It's also the standard entry point for inpainting-style masks and any pipeline where an image becomes a starting state.

Inputs and outputs

Inputs: pixels (an IMAGE - the picture you're compressing) and vae (the encoder, from a checkpoint loader, VAE Loader, or Simple SDXL Loader). Outputs: latent (ready for a KSampler or latent-space manipulation) and summary.

The one thing worth internalizing

Encoding is lossy. Each pixels→latent→pixels round trip degrades an image a little, which is exactly why the community warns against chained img2img passes that encode and decode over and over - the image grinds down. So the rule of thumb: encode once, do your latent-space work, decode once at the end. Also keep the VAE pairing in mind: the encoder must match the checkpoint's latent space, or you're pushing the wrong-shaped data into the sampler. (The same shared-VAE logic is why two models on the same autoencoder can hand latents to each other and skip a decode/encode cycle entirely - that's the power move when your models support it.)

Install

Ships with OmniNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/TensorVizion/OmniNodes

Or ComfyUI Manager β†’ OmniNodes β†’ restart. No extra dependencies. Found under TensorVizion/Model Utilities (the pack's sampling wrappers all categorize there, not in a dedicated Sampling submenu).

Troubleshooting

  • Latent looks wrong dimensionally - check your image resolution is VAE-friendly (multiples of 8 for SD/SDXL). The pack has a Resize to Multiple node for exactly this.
  • Colors shift through the round trip - expected to a small degree; encode/decode is lossy. If it's extreme, check the VAE pairing.
  • Node missing - restart ComfyUI and check [OmniNodes] in the terminal log.

Reach for it when a workflow needs to start from something you already have. It's the unglamorous first step of every good img2img chain.

CategoryTensorVizion/Model Utilities

Inputs (2)

NameTypeDefaultDescription
pixelsIMAGEβ€”
vaeVAEβ€”

Outputs (2)

NameTypeDescription
latentLATENTβ€”
summarySTRINGβ€”