Nodes/ComfyUI_agilly1989_motorway/VAEEncode_motorway_edition
ComfyUI Node

VAEEncode_motorway_edition

Pixels to latent β€” the front half of every img2img, on the Motorway

By agilly1989Β·Created 2 years agoΒ·Updated about a year agoΒ· 7
VAEEncode_motorway_edition
  • MOTORWAY πŸšŒπŸ’¨
  • MOTORWAY πŸšŒπŸ’¨
β—„INPUT_pixels_keypixelsβ–Ί
β—„INPUT_vae_keyvaeβ–Ί
β—„OUTPUT_LATENT_keyLATENTβ–Ί

VAEDecode gets all the glory because it's the last node before you see the picture. VAEEncode is the unglamorous mirror image: it takes pixels and compresses them into the latent space where diffusion actually runs. Every img2img, every inpaint, every "run this image through the sampler again" workflow starts here. This _motorway_edition clone does that encode through the agilly1989 Motorway pipe, reading the image and VAE from the shared dict by key instead of from wires.

Motorway, quick version: start with MotorwayStart, then each _motorway_edition node trades data wires for key strings, reading and writing a shared dict that flows down one MOTORWAY connection. These are auto-generated clones of core ComfyUI nodes, so the encode math is identical to stock.

What it does. It takes pixels (an IMAGE) and a vae, encodes the image into a latent, and stores it. The latent isn't a picture you can look at - it's the compressed representation the sampler denoises. On the Motorway, INPUT_pixels_key (default pixels) points at the image in the dict, INPUT_vae_key (default vae) points at the VAE, and OUTPUT_LATENT_key (default LATENT) is where the encoded latent lands.

The inputs that matter. MOTORWAY is required. The three key fields are the whole interface. And here's the trap that trips everyone on the first Motorway graph: the VAE loader stores its output under VAE uppercase, while this node's default lookup key is vae lowercase. If you loaded the VAE with VAELoader_motorway_edition and left its defaults, set INPUT_vae_key to VAE or the encode fails with 'MotorwayClass' object has no attribute 'hash_' - the pack's "key not in the Motorway" error. It's the same uppercase-stores/lowercase-reads mismatch you'll see on every consumer node in this pack.

Common issues. Beyond the case mismatch, the VAE advice that matters: use the VAE your checkpoint was trained against. Encoding with the wrong architecture's VAE produces a latent that samples into garbage. One encode-decode round trip also costs a little quality each time, so chaining img2img passes grinds an image down - a Motorway that routes the same image through several encodes will show it. And the standing caveat: if the node isn't in your menu, the pack's current main branch has the clone registration commented out in __init__.py.

Install via ComfyUI Manager (search "ComfyUI_agilly1989_motorway") or git clone https://github.com/agilly1989/ComfyUI_agilly1989_motorway into custom_nodes, then restart. No models, no dependencies. Solo-dev beta pack with a README that says "if things break it's because I broke it" - keep the Motorway as a convenience layer, not the foundation.

Categoryagilly1989 Nodes/Motorway-ed/latent

Inputs (4)

NameTypeDefaultDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”
INPUT_pixels_keySTRINGpixelsβ€”
INPUT_vae_keySTRINGvaeβ€”
OUTPUT_LATENT_keySTRINGLATENTβ€”

Outputs (1)

NameTypeDescription
MOTORWAY πŸšŒπŸ’¨MOTORWAY πŸšŒπŸ’¨β€”