Loop Image Selector
The reference-image picker that makes looped videos swap singers cleanly
- image_batch
- previous_frames
- ref_image
- context_frames
If you've seen those long AI talking-head or "character singing" videos, the loop mechanics underneath them are simple to describe and fiddly to build: you've got several reference images (singer A, singer B, maybe a wide shot), the video loops through them, and every time the image changes the transition has to look intentional instead of like a glitch. Loop Image Selector is the node that picks which reference image the current loop gets and handles the seam where the previous image's frames meet the new one.
It's the data-selection half of the same loop family as Loop Calculator and Loop Align Silence in this pack - feed it the loop index you're on, tell it where transitions happen, and it hands back the right reference image plus a context frame batch for your sampler.
How it works
You give it loop_index (typically the current iteration counter from your loop, and the author's tooltip literally suggests wiring it from Get_loop_index), a loop_positions string like "0, 12, 24" listing where image changes occur, and overlap (how many frames to blend or duplicate at a transition). Internally it finds the largest position that's less than or equal to your current loop, then grabs that position's reference image - from a dynamic input slot (image_1, image_2, …) or from an image_batch if you prefer batches. Dynamic slots auto-appear up to 64 of them, which is the inputcount widget's whole job.
The clever part is context_frames. On a normal loop it just passes your accumulated previous_frames through untouched. At a transition loop, it combines the tail of the old context with the new image, and there are three overlap_mode options for how:
concat- just append the new image frames. Simple, and the default.linear_blend- crossfade the overlap window from old to new.pyramid_blend- a Laplacian pyramid blend, which blends each spatial frequency band separately. It's slower, but it gives noticeably sharper edges on a transition than a flat pixel crossfade, and it's the one I'd reach for when the swap is between two faces.
If your reference images and context frames are different resolutions it center-crops and rescales to match the existing context, preserving aspect ratio.
The inputs that matter
loop_indexandloop_positions- the pair that does the actual selecting. Get these wrong and you get the wrong singer at the wrong time, which is the failure you'll see first.overlap_mode- the only input you'll actually iterate on.concatfor speed,pyramid_blendwhen seams matter.previous_frames- wire this to your accumulated output from the loop, or the transition blending has nothing to blend with.
Outputs: ref_image (a single frame, length 1, feeding your reference image input) and context_frames (the frames to feed the sampler).
Install
Part of ComfyUI_Eclipse (r-vage), the big utility pack that replaced the old RvTools_v2. ComfyUI Manager - search ComfyUI_Eclipse - or:
cd ComfyUI/custom_nodes
git clone https://github.com/r-vage/ComfyUI_Eclipse
Restart ComfyUI. No special dependencies beyond the pack's usual stack (which ComfyUI mostly ships already), no model downloads. If you loaded a shared workflow that references [Eclipse] nodes and it fails, it's almost always the v4.0 legacy-node removal - run the built-in Workflow Migration Tool before pulling your hair out.
Common issues
The two traps are a mismatch between loop_positions and your actual loop indexing (a one-off that shifts every selection after it), and forgetting previous_frames, which makes transitions degrade to a hard cut. If the node errors with "No reference image found," you've hit a loop index with no matching slot - check that your positions list isn't asking for image_5 when you only connected four. And for face swaps specifically: leave it on concat while you debug, switch to pyramid_blend last. It's the difference between "looks like a cut" and "looks like the camera blinked."
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| loop_index | INT | 00–4096 | The current loop index (e.g. from Get_loop_index). |
| loop_positions | STRING | 0, 2 | Comma-separated list of loop indices where transitions/image changes occur. |
| overlap | INT | 90–4096 | Number of overlapping frames to blend or duplicate at transition points. |
| overlap_mode | COMBO | concat | Mode to combine previous frames with the new image context. |
| inputcount | INT | 22–64 | Used by the dynamic inputs frontend to show connected image slots. |
| image_batchopt | IMAGE | Optional batch of input images (alternative to individual connections). | |
| previous_framesopt | IMAGE | The accumulated output frames of all previous loops (from the parent loop feedback). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| ref_image | IMAGE | The single selected reference image (length 1). |
| context_frames | IMAGE | The context frames to feed the sampler. |