XB-BOX - VAE编码(原版优化)
Get your reference images into latent space without the OOM cliff
- pixels
- vae
- LATENT
Encoding is the step people forget about until it bites them. Decoding big latents gets all the attention, but feeding a high-res reference image into the VAE encoder is just as memory-hungry - and it's the thing you need every time you're doing img2vid, image-to-image, or feeding a reference frame into a Wan pipeline. XB_ROCmVAEEncode is the XB_ToolBox tiled encoder: it takes your pixels, chunks them, encodes tile by tile, and hands you back a LATENT that fits in your card.
And yes, the same naming caveat applies as everywhere in this pack's "原版优化" family: "ROCm" is legacy branding, not a requirement. Under the hood this is ComfyUI's official VAEEncodeTiled, wrapped for parameter-name compatibility plus the pack's four-level cleanup option.
Inputs
- pixels - the IMAGE to encode.
- vae - your VAE.
- tile - spatial tile size, default 0 (wrapper maps it to 512). This is the memory dial: smaller tile = less VRAM per pass.
- overlap - overlap between tiles to avoid seams at the borders.
- temporal_size / temporal_overlap - included for video-VAE inputs (batch of frames); on a still image they're no-ops.
- cleanup - none / cache purge / unload models to RAM / full unload.
Output is a single LATENT, ready to feed a sampler as a starting point or to a conditioning/reference workflow.
Where it fits
The classic use: you have a reference image and you want the diffusion model to start from its latent instead of pure noise. Wire this node's output into a sampler's latent_image, or use it in a pipeline where a reference latent gets baked into conditioning (the pack's Qwen edit encoders do the same VAE-encode-reference trick internally). The tiled behavior is the point - on a 16GB card, encoding a 4K storyboard frame non-tiled is a great way to learn the exact look of a CUDA out-of-memory error.
A couple of honest notes
First, because it's a compatibility alias, it uses the old tile/overlap names rather than ComfyUI's current tile_size/overlap - the wrapper translates for you, so don't get confused when you compare against the stock node. Second, like the pack's other wrappers, it inspects your ComfyUI build and silently skips parameters (here, the temporal ones) that a given version doesn't support, so it won't hard-crash on older installs.
If you're starting fresh, ComfyUI's own VAEEncodeTiled does the identical job with current parameter names. This node earns its place if you're on a shared old workflow, or you specifically want the cleanup dropdown bolted on. Install is the pack standard:
cd ComfyUI/custom_nodes
git clone https://github.com/wjluoxiao/XB_ToolBox.git
restart, and it lives under "XB_ToolBox/原版优化". No extra pip dependencies.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| pixels | IMAGE | — | |
| vae | VAE | — | |
| tile | INT | 00–4096 | — |
| overlap | INT | 00–256 | — |
| temporal_size | INT | 00–1024 | — |
| temporal_overlap | INT | 00–64 | — |
| cleanup | COMBO | 不做任何清理 | 4 options: 不做任何清理, 单次缓存清理, 卸载显存模型, 卸载全量模型 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | — |