Nodes/ComfyUI-HeresyNodes/⛧Stitch Images Multi
ComfyUI Node

⛧Stitch Images Multi

Stitch chunked video frames back into one continuous clip, seams and all

By heresyCoder·Created 3 months ago·Updated 3 months ago· 2
⛧Stitch Images Multi
  • source_dict
  • image
overlap13
overlap_sidesource
overlap_modelinear_blend

Chunked video generation has an ugly moment: you've rendered sections 01, 02, 03 as separate frame batches, and now you need them to be one video. A naive concatenation gives you a visible jump at every seam - frame 80 of one chunk butts straight into frame 1 of the next. Stitch Images Multi is the node that joins those batches properly, blending across a shared overlap region so the cut disappears.

This is the assemble step in this pack's Wan loop pipeline. The save side writes each chunk's frames into a numbered folder; this node reads them back from a dict and welds them into a single long batch you can encode to video. If you're hand-rolling multi-chunk Wan (the 81-frame context window forces it), this is the restitch you were doing by hand.

The inputs

  • source_dict - a DICT mapping keys (like 01, 02) to image batches. Keys are sorted ascending, so the order comes from the folder names, not from insertion order.
  • overlap - how many frames of each batch overlap the next. Default 13. This is the number you were using as your chunk-extension overlap; it must be smaller than every batch's length.
  • overlap_side - source (default) overlaps on the tail of the existing clip, or new_images overlaps on the head of the incoming chunk. Matters when your chunks were generated with their context on one side.
  • overlap_mode - how the overlapping frames are merged. Five choices, this is the real meat.

The blend modes

  • cut - no blending, a hard join at the overlap boundary. Fast, and fine when you don't trust the overlap.
  • linear_blend - a straight crossfade across the overlap. The default, and the sensible starting point.
  • ease_in_out - a smoothstep crossfade; gentler ramps at both ends of the overlap.
  • filmic_crossfade - blends in gamma-2.2 "linear light" space, which avoids the darkening dip you get from crossfading midtones in sRGB. This is the one to pick when the linear crossfade makes the seam look muddy.
  • perceptual_crossfade - converts to LAB color space, blends there, converts back. Best-looking in theory; costs extra, and it needs kornia installed (the import is lazy, so it only fails when you actually pick this mode).

Mechanically it sorts the dict keys, validates every batch matches the first batch's dimensions (mismatch → ValueError), precomputes the blend weights once, and does a single torch.cat. The overlap math is exactly the "stepping by N with M-frame overlap" pattern from the long-form Wan chunkers - this node just owns the join.

Install and gotchas

It's in ComfyUI-HeresyNodes:

cd ComfyUI/custom_nodes
git clone https://github.com/heresyCoder/ComfyUI-HeresyNodes

Restart after cloning, or install via Manager ("ComfyUI-HeresyNodes"). No model downloads; kornia is only needed for the perceptual mode (pip install kornia in your ComfyUI environment).

Two failure modes to respect: overlap greater than a batch's frame count raises immediately, and mismatched batch sizes raise with a message naming the offender. And the dictionary input means you need a node that outputs DICT upstream - in this pack that's Load Image Folders, whose numbered-folder output is exactly what this node expects. If the seams still show, you're not fighting the stitch - you're fighting drift across chunk boundaries, which is a Wan context problem no crossfade fully fixes.

Category⛧Heresy Nodes/image

Inputs (4)

NameTypeDefaultDescription
source_dictDICTThe source dictionary of image batches
overlapINT131–4096Number of overlapping frames between source and new images
overlap_sideCOMBOsourceWhich side to overlap on
overlap_modeCOMBOlinear_blendMethod to use for overlapping frames

Outputs (1)

NameTypeDescription
imageIMAGE