Nodes/ComfyUI_Swwan/Reverse Image Batch (Swwan)
ComfyUI Node

Reverse Image Batch (Swwan)

Flip the frame order without touching a pixel

By aining2022·Created 10 months ago·Updated about 18 hours ago· 33
Reverse Image Batch (Swwan)
  • images
  • IMAGE

One input, one output, one job: take an IMAGE batch and hand it back with the frames in the opposite order. That's it. This is the smallest node in the pack and the one you'll forget you have, right up until you need a clip to run backwards and can't find a stock node that does it.

It earns a place in video work specifically. Any time you generate a motion and want it undone - a push-in that becomes a pull-out, an entrance played as an exit, an AnimateDiff or Wan clip you're going to loop - you need the batch reversed before whatever stitches or encodes it. Order is semantically load-bearing downstream: Video Combine, interpolation, and the pack's own transition and concat nodes all read the batch in index order, so reversing after them means redoing them.

How it works

The implementation is one line of tensor work: torch.flip(images, dims=[0]). Dim 0 is the batch dimension, so the frames come back reversed, same resolution, same channel count, same dtype, no resampling, no quality loss, nothing decoded or re-encoded. It also means it's effectively free - a view-level reorder rather than a copy of the pixels through PIL, which is why you can park it mid-graph on a 200-frame clip and not care.

Note what it does not do: it doesn't invert time in a physically meaningful way. Reversing a 24-frame clip of a moving shot gives you a clip where the frames play backwards, which is a look, not a re-render. For the "reverse the motion, keep the subject" trick you need the model to see the reversed conditioning - which is a different problem solved by reversing the frames before a video-model pass, not after.

Inputs and outputs

From the node's schema: a single required input, images (IMAGE), and a single output, IMAGE. No seed, no options, no count widget, no cleverness.

A beginner-friendly reading of that: it slots anywhere in a chain of IMAGE nodes. Load Video → Reverse → Video Combine, or AnimateDiff → Reverse → Save. Because the output re-declares as IMAGE, you can chain it with its sibling Shuffle Image Batch (Swwan) if you're doing something chaotic, or with Get Image Range From Batch when you only want the tail reversed.

Install

Part of aining2022/ComfyUI_Swwan - one pack, 118 nodes, so install the pack once and you get this plus the batch, mask, resize and save tooling around it. Manager → search Swwan, or:

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

Then restart ComfyUI and hard-refresh the browser tab. No models, no extra downloads for this node.

Where people get burned

The batch you reversed isn't the batch you thought. With a Load Images folder loader, the batch is in filename sort order - reverse it and you get that order backwards, which is fine. With frames already concatenated from multiple clips, you're reversing the whole run, seams and all. Check the batch count with Get Image Size And Count if a reverse comes out weirder than expected.

Reversing before an interpolator gives you interpolated reverse motion, not a reversed interpolation. Order of operations is the bug, not the node. Put the reverse at the point in the graph where the order genuinely changes meaning.

Integer/plugin drift. If an old workflow shows this node as missing, remember the pack re-registered everything under Swwan-prefixed IDs and doesn't claim the original packs' names - so an old ReverseImageBatch, if you had it from KJNodes, is a different node. The repo ships scripts/migrate_workflow.py (dry-run it first) and docs/NODE_CATALOG.md maps old names to new.

That's the entire node. It's plumbing, and plumbing is supposed to be boring.

CategorySwwan/Advanced/Batch

Inputs (1)

NameTypeDefaultDescription
imagesIMAGE—

Outputs (1)

NameTypeDescription
IMAGEIMAGE—