Nodes/Arctenoxs-Essentials_ComfyUI/VAE Encode + Dimensions (Arctenox's Essentials)
ComfyUI Node

VAE Encode + Dimensions (Arctenox's Essentials)

A VAE encode that tells you what it just ate

By Arctenox·Created 8 months ago·Updated 2 months ago· 1
VAE Encode + Dimensions (Arctenox's Essentials)
  • image
  • vae
  • latent
  • width
  • height
tile_encodefalse

Every img2img workflow starts the same way: an image goes into a VAE encoder, a latent comes out, and somewhere downstream you need to remember what resolution that image was. ComfyUI's plain VAE Encode hands you the latent and leaves the remembering to you. VAE Encode + Dimensions is a thin wrapper that also passes the source image's pixel width and height out as INT values, so you can wire them straight into a KSampler Refiner (as target_width/target_height) or the pack's Execution Cost Estimator without adding a separate Image Dimensions node.

That's the whole pitch, and it's genuinely convenient in a two-pass workflow: encode your base image, feed the latent and the dimension INTs to the refiner, and the refiner can hit the exact same resolution instead of guessing from a scale factor.

The inputs are as minimal as it gets:

  • image - the IMAGE tensor to encode.
  • vae - the VAE to use.
  • tile_encode (optional, default off) - uses VAE.encode_tiled instead of a straight encode to cut peak VRAM on very large images. The tradeoff is the author's own warning: at extreme resolutions you can get subtle tile seams on high-contrast edges. Leave it off unless you're actually bumping into VRAM limits - the seams are usually invisible, but "usually" isn't "never."

Outputs are latent (ready for a sampler or refiner), width, and height. Note those are the source image's pixel dimensions, not the latent's - the latent is one-eighth of that per side (or one-sixteenth of the pixel count, depending on which VAE you're using). Don't wire width into something expecting latent-space coordinates; in practice the refiner and cost estimator expect pixels, so this is the right thing to hand them.

Mechanically there's no magic - a look at the source confirms it's a thin vae.encode (or encode_tiled) call with the shape read off the tensor and returned alongside the latent. It even logs the WxH → latent shape line to the console, which is quietly useful for debugging why a workflow came out oddly sized. If your VAE doesn't have encode_tiled (some third-party ones don't), it falls back to a normal encode and prints a warning instead of crashing - nice touch.

Where you'd reach for this instead of the stock node: any workflow where resolution is a variable you want downstream nodes to know about - img2img refinement, batch workflows processing mixed-resolution images, or wiring into the pack's cost estimator. If your resolution is hardcoded and never changes, the stock VAE Encode plus a couple of manually-typed INTs does the same thing with less ceremony.

Install. It ships in Arctenox's Essentials: ComfyUI Manager → search "Arctenox's Essentials", or:

cd ComfyUI/custom_nodes/
git clone https://github.com/Arctenox/Arctenoxs-Essentials_ComfyUI

Then restart ComfyUI. No model files to download, and the only Python requirements are torch, numpy, and optional psutil - you almost certainly already have all of them. One heads-up: the README flags the whole pack as deprecated while the author remasters it, so this node may move into a successor pack eventually.

CategoryArctenox Essentials/Latent

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
vaeVAE
tile_encodeoptBOOLEANfalseUse tiled VAE encoding to reduce VRAM usage. Useful for very large images. May produce subtle tile seams on high-contrast edges at extreme sizes.

Outputs (3)

NameTypeDescription
latentLATENT
widthINT
heightINT