Nodes/XB_ToolBox/XB_Wan22ImageToVideoLatent
ComfyUI Node

XB_Wan22ImageToVideoLatent

A start image in, a Wan 2.2 latent out — the I2V setup that doesn't fight the VAE

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB_Wan22ImageToVideoLatent
  • vae
  • start_image
  • latent
width1280
height704
length49
batch_size1
vae_tile_size64
scale_methodlanczos
crop_modecenter

Image-to-video on Wan 2.2 needs three things wired up correctly: a start image encoded into the right latent channel, a mask that tells the sampler "the first frame is fixed," and a latent shaped to the 48-channel MoE layout. Do any of those slightly wrong and you get a video that ignores your start frame or collapses into noise. XB_Wan22ImageToVideoLatent is the pack's drop-in for that whole setup - it builds the latent, encodes your start image with tiled VAE encoding, and sets the noise mask, all in one node.

The mechanism is worth understanding at the level of "what's the risk": the source allocates a 48-channel latent (height//16 × width//16 spatial compression, because Wan 2.2's VAE is a 16x spatial compressor), encodes your start_image through a tiled encode_tiled call, copies the encoded frames into the head of the latent, and zeroes the matching region of the noise mask so the sampler treats those frames as given rather than noise. vae_tile_size (default 64) is the memory knob - it tiles the encode so a 720p start image doesn't spike VRAM.

Inputs and outputs

Required: vae, width (default 1280), height (default 704), length (default 49, stepped by 4), batch_size, and vae_tile_size.

Optional:

  • start_image - the frame to anchor on. The whole point of the node.
  • scale_method (default lanczos) and crop_mode (default center) - how the image is resized to your canvas.

The single output is latent - a LATENT already carrying the encoded start frame and its noise mask. It plugs straight into XB_WanSampler or any Wan-compatible sampler, no other conditioning prep needed.

What to watch

This is the vanilla I2V node - it does not take reference images or control videos. If you need the reference + control-video flavor, that's XB_Wan22FunControlToVideo. Two practical notes: first, feed it a single image, not a batch, unless you deliberately want multi-frame seeding; the code happily slices start_image[:length]. Second, the default 1280x704 is aimed at the 720p tier of Wan 2.2 - on a 12GB card you'll want to drop that and rely on vae_tile_size and block swap to survive.

Also worth saying plainly: this node builds conditioning for the Wan architecture specifically. It expects your sampler and model to be Wan 2.2 (the 48-channel layout is hardcoded for it), so don't wire this into an SD/SDXL sampler and wonder why nothing happens.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git

then restart, or install through ComfyUI Manager (search "XB_ToolBox"). No extra pip packages beyond the pack's usual set.

CategoryXB_ToolBox/Pipeline

Inputs (9)

NameTypeDefaultDescription
vaeVAE
widthINT128016–8192
heightINT70432–8192
lengthINT491–8192
batch_sizeINT11–4096
vae_tile_sizeINT6464–3840
start_imageoptIMAGE
scale_methodoptCOMBOlanczos5 options: lanczos, bilinear, bicubic, nearest-exact, area
crop_modeoptCOMBOcenter2 options: center, disabled

Outputs (1)

NameTypeDescription
latentLATENT