ComfyUI Node

Comparison Swipe Video

Comparison Swipe Video — before/after as an animated wipe, straight out of the node

By marcoc2·Created 2 years ago·Updated 5 months ago· 1
Comparison Swipe Video
  • image_before
  • image_after
  • frames
length60
resolution_source
division_factor1.0
line_color
line_width4

The before/after comparison is a genre of its own: two images, one slider, and a viewer drags the boundary to see the difference. Static side-by-sides don't show it. ComparisonSwipe renders the animated version - the boundary sweeps from one side to the other across a sequence of frames - and hands you the whole batch, ready for any video encoder.

You've seen this exact effect in every model showcase video ever made, and it's a genuinely good way to present upscales, restorations, or inpaints. The difference is it's usually cut together in a video editor afterward. This node does it inside ComfyUI, so your entire comparison video comes out of a graph, reproducibly.

How it works

It takes two images - image_before and image_after - and generates length frames (default 60). Each frame shows the "after" image on the left of the boundary and the "before" image on the right, with the boundary advancing across the frame as you move through the sequence. The first frame is entirely the "before" image, and the boundary sweeps right until the last frame is entirely the "after" image.

It normalizes the two images first: you pick which one defines the resolution (resolution_source as match_before or match_after), the other is resized to match, and an optional division_factor shrinks the whole thing (useful for keeping render times sane). The divider line is drawn in your choice of line_color (white or black) at line_width pixels. The output is a batch of length frames you can feed straight into a video encoder (the pack's own VHS/AnimateDiff-compatible chains, or ComfyUI's video save nodes).

Inputs and outputs

  • image_before / image_after (IMAGE) - the two images.
  • length (INT, default 60) - number of frames.
  • resolution_source - which image sets the canvas size.
  • division_factor (FLOAT, default 1.0) - downscale factor; 2.0 halves the resolution.
  • line_color (white/black) and line_width (INT, default 4) - the divider look.

Output: frames (IMAGE) - the batch of wipe frames. That's the whole payload; encode it and you're done.

Installing it

Part of the AnotherUtils pack:

cd ComfyUI/custom_nodes
git clone https://github.com/marcoc2/ComfyUI-AnotherUtils.git

Restart ComfyUI, or install via ComfyUI Manager (search "AnotherUtils"). It uses opencv-python for the resizing and frame math - if the node fails to import on a fresh environment, pip install opencv-python in your ComfyUI environment is the fix.

Gotchas

It takes the first frame of each input batch, so if you feed it video batches, you get a comparison of the first frames only - a single wipe, not a per-frame one. For a real side-by-side comparison of two videos, you'd want the pack's video stacking tools instead.

The divider is a hard line, no blending - that's the classic "wipe" look, but if you want a soft crossfade boundary this node isn't doing it. And length at 60 frames with default resolution gives a 2-second wipe at 30fps, which reads well; going much longer without raising the frame count just makes the wipe feel slow. Keep the resolution modest (that's what division_factor is for) unless you enjoy waiting.

It's a narrow tool, but when you need a before/after clip it's the exact thing, and it makes comparison videos boringly easy to regenerate with different images.

Categoryimage/animation

Inputs (7)

NameTypeDefaultDescription
image_beforeIMAGE
image_afterIMAGE
lengthINT602–1000
resolution_sourceCOMBO2 options: match_before, match_after
division_factorFLOAT1.00.1–16
line_colorCOMBO2 options: white, black
line_widthINT41–50

Outputs (1)

NameTypeDescription
framesIMAGE