ComfyUI Node

Image List Sampler

Evenly pick N frames from a sequence, and get their positions too

By marcoc2·Created 2 years ago·Updated 5 months ago· 1
Image List Sampler
  • images
  • sampled_images
  • indices
count3
target_frames0

Image List Sampler is the "give me N frames spread across this sequence" node, and its real superpower is that it gives you the positions along with the frames. You hand it a list of images - video frames, a keyframe sequence, anything - and a count, and it returns that many evenly spaced frames and the index of each in the original sequence. That pairing is what makes it useful, because the indices are exactly what a video-conditioning node needs to know where each frame belongs in the timeline.

The mechanism is simple arithmetic, which is good because it's predictable. Given a sequence of total frames and a requested count, it steps through at (total-1)/(count-1) intervals and rounds - which means the first and last frames are always included, and the rest are as evenly spread as integers allow. The count=1 edge case just returns the first frame and index 0. The target_frames input (default 0, off) is the interesting one: when set above 0, the indices output is scaled to that length instead of the source length. So you can sample 5 frames from a 100-frame source but have their positions reported as if the timeline were 250 frames long - which is exactly what you want when feeding reference frames into a video model whose output length differs from the source.

Both outputs are lists: sampled_images (the picked frames) and indices (their positions). And since the node is list-aware, you can feed it batches or lists interchangeably and it flattens them.

Where you'll actually use it: this is the missing link between "I have a long image sequence" and "I want 5 reference frames injected into my video at sensible points." It pairs directly with the pack's LTXVMultiGuide, which takes an indices input - sample N frames, wire sampled_images into the guide's images and indices into its indices, and your references land at evenly spaced points in the generated clip. That workflow - sample evenly, inject as keyframes - is the intended design, and it's a genuinely nice one.

Gotchas are minimal but real. The sampling is even-spacing, not "most representative" - if your sequence has 300 near-identical frames and one critical frame in the middle that isn't near a sampling point, it'll be skipped; for that you'd want smarter selection. And the count default of 3 is a starting point, not a recommendation - for LTX keyframing, more frames usually means tighter control but a heavier conditioning pass, so tune it to taste.

Install: ComfyUI Manager → search "AnotherUtils", or cd ComfyUI/custom_nodes && git clone https://github.com/marcoc2/ComfyUI-AnotherUtils, then restart. Pure Python, no dependencies, no models - about as lightweight as the pack gets.

CategoryAnotherUtils/logic

Inputs (3)

NameTypeDefaultDescription
imagesIMAGE
countINT31–10000
target_framesINT00–10000If > 0, outputs indices scaled to this length.

Outputs (2)

NameTypeDescription
sampled_imagesIMAGE
indicesINT