Nodes/ComfyUI_Swwan/Cross Fade Images (Swwan)
ComfyUI Node

Cross Fade Images (Swwan)

Fade out of one batch, into another

By aining2022·Created 10 months ago·Updated about 18 hours ago· 33
Cross Fade Images (Swwan)
  • images_1
  • images_2
  • IMAGE
◄interpolation▾►
◄transition_start_index1►
◄transitioning_frames1►
◄start_level0.00►
◄end_level1.00►

What it does

You rendered two clips (or two sets of frames) and you want the second one to dissolve in partway through the first. Cross Fade Images takes batch A and batch B, starts the blend at a frame you choose in A, mixes frame-for-frame for as many frames as you ask, then continues playing the rest of B. Output is one batch.

It's KJNodes' CrossFadeImages under a Swwan ID, and it's the simplest member of this pack's transition family - the other two are Cross Fade Images Multi (chains several batches) and Image Batch Join With Transition (slide/door/circle wipes).

The mechanism, plainly

The node builds alphas with linspace(start_level, end_level, N), runs each through the interpolation curve, and mixes: out = (1 - alpha) * A + alpha * B. So alpha is literally "how much of batch B you're seeing". start_level / end_level at their defaults (0 and 1) mean a clean full dissolve from A to B; set both to 0.5 and you get a 50/50 ghost blend instead.

N is clamped to the smallest of transitioning_frames, the frames remaining in batch A after transition_start_index, and the length of batch B. The output is A[:start_index] + the N blended frames + B[N:] - so B's first N frames are consumed by the fade and don't appear afterwards. Total output length is start_index + len(B).

  • interpolation - linear, ease_in, ease_out, ease_in_out, bounce, elastic, glitchy, exponential_ease_out. Linear is the safe default. glitchy is a deliberately non-monotonic curve (a plus a sine wobble) and reads as a stutter-cut; bounce and elastic overshoot, which can look great on a flash cut and terrible on a slow dissolve.
  • transition_start_index - default 1. Negative values index from the end of batch A, so -1 starts the fade on the last frame.
  • transitioning_frames - how many frames the dissolve lasts. Leave this at the default of 1 and nothing visibly happens: linspace with one step returns the start value, so you get a single frame that's just a copy of A. This is the single most common "the node is broken" report, and the node is not broken.
  • images_1, images_2 - any size. The frames are element-wise mixed, so mismatched resolutions will either broadcast badly or error; resize first.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/aining2022/ComfyUI_Swwan
cd ComfyUI_Swwan
python -m pip install -r requirements.txt

Or Manager → ComfyUI Swwan, then restart ComfyUI and hard-refresh the browser. Pure tensor maths, no models, no optional dependencies - this is one of the nodes that made the pack worth having if you already do video work in ComfyUI.

Where it fits

The transitions here are frame-level, which is why they pair so naturally with the sliding-context-window style of video generation: you extend a clip by overlapping frames with the previous segment, and the seam is where a fade or a blend earns its keep. Related nodes in the same pack: Image Batch Extend With Overlap for the extension step itself, and Cross Fade Images Multi when you have more than two clips to stitch.

Two smaller notes. First, this node does not resample - if your two batches are 24fps and 12fps you're editing frame timings by hand, or doing the fade in a compositor. Second, images_2 is only read from its first N frames during the fade and from frame N onward afterwards, so a short batch B with a long transitioning_frames just produces a short result rather than an error. Check the length of what comes out before you feed it to a video combine node, because a silently shortened batch looks like a dropped-frame bug elsewhere.

CategorySwwan/Advanced/Image

Inputs (7)

NameTypeDefaultDescription
images_1IMAGE—
images_2IMAGE—
interpolationCOMBO8 options: linear, ease_in, ease_out, ease_in_out, bounce, elastic, +2
transition_start_indexINT1-4096–4096—
transitioning_framesINT10–4096—
start_levelFLOAT0.000–1—
end_levelFLOAT1.000–1—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—