ComfyUI Node Runs on cloud

Tiled VAE Encode

Feeding a big source image into img2img without dying

By shiimizu·Created 3 years ago·Updated about a year ago· 543
Tiled VAE Encode
  • pixels
  • vae
  • LATENT
tile_size512
fasttrue
color_fixtrue

This is the mirror image of Tiled VAE Decode, and it covers a failure people run into constantly on big img2img upscale passes: you load a large source image, it never even reaches the sampler, and the crash happens right at the VAE Encode step - turning your source image into a latent. This node does that conversion in tiles instead of all at once, so encoding a big image doesn't need the whole thing in VRAM at the same moment.

Why you'd reach for it

This is the node that starts the classic "big img2img upscale" pipeline: take a large source image → encode it (this node) → run it through a low-denoise pass, usually paired with Tiled Diffusion for the sampling and a ControlNet Tile condition to keep detail faithful to the source → decode it back out (Tiled VAE Decode). That whole chain, all tiled end to end, is one of the more dependable ways the community has landed on for print-size or otherwise huge upscales that a stock pipeline just can't hold in memory. If you're doing that kind of pass and your source image is already large, this node is where it starts.

How it works

Same underlying trick as the decode node, tiled the other direction, plus one extra option specific to encoding:

  • fast - same speed/fidelity tradeoff as the decode node. Off does the full task-queue-with-GroupNorm-synchronization dance across tiles (slower, more faithful); on downsamples the input once, computes shared GroupNorm stats from that, and every tile reuses them (faster, can shift color/contrast slightly).
  • color_fix - a middle ground specific to the encoder. Per the README, it estimates GroupNorm before downsampling - a semi-fast mode - and it's specifically there to restore color accuracy when your tile_size is small enough that individual tiles start drifting in color from each other.

Inputs and outputs

  • pixels (IMAGE) - your source image, straight from a LoadImage node or wherever it's coming from.
  • vae (VAE) - same VAE you'd wire into a normal encode.
  • tile_size (default 512, range 256–4096) - pixel size per tile, suggested at a sensible starting value based on your VRAM when the node is added.
  • fast (default on) - speed vs. fidelity, as above.
  • color_fix (default on) - corrects color drift on small tiles, encoder-only.

Output is a LATENT, same shape a normal VAE Encode gives you - wire it into a KSampler's latent_image input for your img2img pass (through Tiled Diffusion if you're also tiling the sampling), or anywhere else in your graph that expects a latent.

How to install it

  • ComfyUI Manager - search "Tiled Diffusion & VAE for ComfyUI", install, restart.
  • Manual - cd ComfyUI/custom_nodes && git clone https://github.com/shiimizu/ComfyUI-TiledDiffusion, then restart.

No extra model downloads - it runs on whatever VAE you're already using.

Common issues & troubleshooting

Colors look inconsistent across the image after encoding, especially with a small tile_size. Make sure color_fix is on - it's on by default, but if someone flipped it off, that's the first thing to check.

Still hitting VRAM limits. Lower tile_size. Smaller tiles cost more time, not more memory - that's the whole trade you're making.

You don't actually need this node. If your source image is modest and a plain VAE Encode already works fine, there's no reason to swap it in - this exists specifically for the case where the source is big enough to be the problem.

Pairing it for an upscale pass. For the full large-image upscale workflow - encode → tiled sample → decode - put a ControlNet Tile preprocessor on the same source image and feed it into your sampling step alongside Tiled Diffusion. Without that condition, tiles processed independently during sampling can drift from each other even though the encode itself is fine; the tile condition is what keeps the diffusion side honest to the source, and this node is only responsible for getting the source into latent space without crashing.

Category_for_testing

Inputs (5)

NameTypeDefaultDescription
pixelsIMAGE
vaeVAE
tile_sizeINT512256–4096
fastBOOLEANtrue
color_fixBOOLEANtrue

Outputs (1)

NameTypeDescription
LATENTLATENT