Nodes/Nifty Nodes for ComfyUI/Merge Image Batches
ComfyUI Node

Merge Image Batches

Stitch two video clips together with an actual crossfade

By Stibo·Created 5 months ago·Updated 2 months ago· 9
Merge Image Batches
  • source_images
  • new_images
  • images
overlap_mode

If you've ever generated two video segments separately and tried to join them, you know the naive way to "merge" a pair of image batches in ComfyUI is a concatenate node - which gives you a hard cut, and if the two clips differ in brightness or motion, that cut is a visible jump. Merge Image Batches does the joining with an optional blended transition, which is the difference between a seam and a cut.

What it is

It takes two image batches - source_images (the base sequence) and new_images (appended after it) - and produces one combined images batch. That's it, as far as the core job. The interesting part lives in the overlap_mode dropdown, which controls how the boundary between the two batches is handled:

  • none - plain concatenation. The hard-cut option.
  • cut - removes overlapping frames from one side before joining, so you can build a clean seam out of two clips that share a boundary.
  • linear_blend - a simple linear crossfade over the overlap region.
  • ease_in_out - an S-curve (smoothstep) crossfade, which looks more natural for motion than the linear version.
  • filmic_crossfade - gamma-corrected (2.2) blend, so perceived brightness stays even through the transition.
  • perceptual_crossfade - blends in LAB color space for the most perceptually even crossfade. It's the fancy one, and it requires the optional kornia package.

The blend modes are the reason to use this node over a raw concatenate. If you're stitching two generated clips of the same scene - say, an extension of a video - ease_in_out is usually the sweet spot between smooth and not-too-smear.

Inputs worth knowing

  • source_images - first batch (optional input, but you'll want it connected).
  • new_images - second batch. Must be the same resolution as source whenever you use any blend mode; mismatched sizes are a guaranteed error or a visually broken seam.
  • overlap_mode - the transition selector above.

Output is a single images batch. Both inputs disconnected yields None.

Installing it

It ships with Nifty Nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/Stibo/comfyui-nifty-nodes

or search "Nifty Nodes" in ComfyUI Manager, then restart. Core blend modes need nothing extra. If you want perceptual_crossfade, install the optional dependency the README calls out:

pip install kornia

Gotchas

The resolution-match rule is the one that bites: blend modes assume both batches share dimensions, so resize the batches to match before the merge - this pack's own resize nodes make that easy. And watch frame rates: this node blends frames one-to-one, it doesn't resample, so two clips at different frame rates will stutter rather than blend cleanly. Also note the pack is built on the newer ComfyUI V3 API - if the node won't appear, update ComfyUI before you start debugging anything else.

Categorynifty/image

Inputs (3)

NameTypeDefaultDescription
overlap_modeCOMBOHow to handle the transition between batches. 'none' = simple concatenation. 'cut' = removes overlap frames. 'linear_blend' = simple crossfade. 'ease_in_out' = smooth S-curve crossfade. 'filmic_crossfade' = gamma-correct blend. 'perceptual_crossfade' = LAB color space blend (requires kornia).
source_imagesoptIMAGEFirst batch — the base sequence.
new_imagesoptIMAGESecond batch — appended after source. Must have the same resolution as source when using any blend mode.

Outputs (1)

NameTypeDescription
imagesIMAGE