Nodes/ComfyUI-SplitImage/Split Latent into Tiles
ComfyUI Node

Split Latent into Tiles

Split the latent, not the pixels — tile after VAE Encode

By QuigleyDown·Created 5 months ago·Updated 5 months ago· 0
Split Latent into Tiles
  • samples
  • tiles
  • rows
  • columns
  • overlap
  • tiling_spec
rows2
columns2
overlap8

Most tiling nodes split pixels. This one waits until after VAE Encode and cuts the latent into tiles instead. Same idea as its sibling Split Image into Tiles - cut into an overlapping grid, process one tile at a time, stitch back at the end - but because you've already compressed to latent space, each tile is a fraction of the memory. That's the difference between "I can sample 1024px tiles" and "I can sample a full 4K render's worth of latent tiles on the same card."

How it works

Mechanically it's the same code path as the image splitter, just against the samples tensor of a LATENT instead of an IMAGE. It takes rows, columns, and overlap, computes ceil((W + (cols-1) * overlap) / cols) per side, zero-pads the latent to make the grid come out even, then cuts tiles at a stride of tile_size - overlap.

The one setting beginners get wrong is overlap. It's measured in latent pixels, not image pixels, and a latent is typically 8x smaller than the pixels it represents - so the default is 8 (≈64px of real image), with a max of 128 (≈1024px). If you copy the image node's habit and type 64 here, you've just asked for ~512px of overlap and every tile is half rework. Keep it in single digits unless you know why you don't.

Outputs are tiles (a list of LATENT dicts), the grid ints, and a tiling_spec. Nice touch: the spec stores everything in pixel terms - it multiplies the latent dims and overlap by 8 - so when you decode the tiles and feed them to Stitch Image Tiles, the stitch node can use the spec directly without caring that the split happened in latent space.

Where it shines

If you're doing a tiled img2img or upscale pass where each tile goes through a KSampler anyway, splitting after encode saves you the VAE round-trip on full-res intermediates. The collector pattern is identical: SplitLatent → KSampler (executes once per list item) → VAE Decode each tile → Stitch Image Tiles. Peak VRAM stays around one tile plus the sampler, which is the entire point of this pack.

One honest caveat: the node builds each output latent as a fresh {"samples": ...} dict, so a noise_mask in your input latent won't carry through the split. For a clean tile-and-stitch that's usually fine - you're doing it to a plain image, not a mask workflow. If you were hoping to tile a masked inpaint, expect to handle the mask separately.

Installing it

Via ComfyUI Manager (search "ComfyUI-SplitImage") or:

cd ComfyUI/custom_nodes
git clone https://github.com/QuigleyDown/ComfyUI-SplitImage.git

Restart ComfyUI. No extra dependencies, no models, no keys - it's pure PyTorch on top of ComfyUI's own stack.

Gotchas

The seam advice from the image splitter applies double here. If your final image shows tile boundaries, your latent overlap is too small for the denoise strength you're running - remember the 8x conversion when you're reasoning about it. And if stitch complains that the tile count doesn't divide cleanly, your grid changed mid-workflow; wire tiling_spec through and let it sort itself out.

CategorySplitImage

Inputs (4)

NameTypeDefaultDescription
samplesLATENT
rowsINT21–100
columnsINT21–100
overlapINT80–128

Outputs (5)

NameTypeDescription
tilesLATENT
rowsINT
columnsINT
overlapINT
tiling_spec*