Nodes/ComfyUI PyramidFlow Wrapper/PyramidFlow VAE Encode
ComfyUI Node

PyramidFlow VAE Encode

Your starting image's trip into latent space

By kijai·Created 2 years ago·Updated 2 years ago· 363
PyramidFlow VAE Encode
  • vae
  • image
  • samples
enable_tilingfalse
overlap_factor0.25

If you've only got text-to-video on your mind, you can skip PyramidFlow VAE Encode entirely. But the moment you want image-to-video - "make this picture move" - this node is mandatory. It takes a still image, pushes it through the PyramidFlow video VAE, and produces the latent that PyramidFlow Sampler needs as its input_latent to anchor generation.

The mechanism is straightforward VAE encoding with a PyramidFlow twist. The node normalizes your image from [0,1] into [-1,1] (matching the model's training distribution), encodes it with the causal video VAE, samples the latent, and then applies the model's image-specific shift and scale factors. Those factors matter: PyramidFlow's latent space is shifted and scaled differently for still images than for video frames, and the encode side has to pre-scale the latent so the decode side's normalization lands where it expects. Get it wrong and your starting image comes back with shifted colors or a baked-in bias. This node gets it right for you, which is the entire reason it exists as a wrapper node instead of a generic VAE encode.

The inputs

  • vae - the PyramidFlow VAE object from PyramidFlow VAE Loader. Same caveat as the decode node: it's the wrapper's own VAE, not ComfyUI's stock one.
  • image - a plain IMAGE. Any still you want as frame zero.
  • enable_tiling - false by default. Interesting reversal from the decode node, which tiles by default. Encode tiles if your image is large and your VRAM small; for a typical 640×384 or even 768 input, encoding without tiling is usually fine and a bit faster.
  • overlap_factor - default 0.25, and only relevant if tiling is on. Same seam-smoothening logic as the decode node.

The output

samples (LATENT) - a latent with a temporal dimension of 1, shaped [1, C, 1, H, W]. It goes into the input_latent socket on PyramidFlow Sampler. Flip that socket on and the sampler switches to image-to-video mode: it treats your latent as the first frame and generates the motion latents around it. The tooltip on first_frame_steps even warns you it stops mattering in this mode - your image is the first frame, so there's no separate first-frame denoise.

One thing to watch: the latent this node emits has to match the sampler's width/height expectations. The sampler will downscale or upscale to its own dimensions, but you'll get the cleanest results when the image's aspect roughly matches the sampler's width/height at the model's 8× downsample. Encode at the resolution you intend to generate at, not at the source file's native size.

Install

It's in the pack, so the standard drill: ComfyUI Manager → search "PyramidFlow Wrapper", or git clone https://github.com/kijai/ComfyUI-PyramidFlowWrapper into custom_nodes and restart. It shares the VAE with the decode node - no extra download beyond the pyramid_flow_vae_bf16.safetensors file already sitting in ComfyUI/models/vae. The pack's img2vid examples (including a 768 variant) are the fastest way to see the whole chain working end to end.

CategoryPyramidFlowWrapper

Inputs (4)

NameTypeDefaultDescription
vaePYRAMIDFLOWVAE
imageIMAGE
enable_tilingBOOLEANfalse
overlap_factorFLOAT0.250–1

Outputs (1)

NameTypeDescription
samplesLATENT