Nodes/ComfyUI_SwiftCut/Select Images
ComfyUI Node

Select Images

Pick Frames Out of a Batch Without a Regex PhD

By yichengup·Created about a year ago·Updated 8 months ago· 10
Select Images
  • image
  • selected_images
indexes0
err_if_missingtrue
err_if_emptytrue

Every AI-video workflow eventually hits the same wall: your model spat out 48 frames and you only want frames 10 through 16, or every 4th frame, or just the last three. Doing that with a pile of "index" math nodes is misery. Select Images is the little utility from the SwiftCut pack that turns that into one text field - it's the frame-picker you didn't know you needed until you've hand-wired a batch index three times in one afternoon.

It's a dead-simple node and proud of it. You give it an image batch, you type an index string, you get back the frames you asked for. Nothing generative, no models, no GPU work - just tensor slicing with a friendly syntax.

The index syntax (this is the whole node)

The indexes field is a multiline string with a grammar that reads like a spreadsheet's:

  • Single: 5 → the 6th frame (indexing is 0-based, so 5 is frame 6)
  • List: 1,3,5 → frames 2, 4, 6
  • Range: 3-10 → frames 4 through 11
  • Range with step: 0-10:2 → every 2nd frame
  • Mixed: 1,3-5,8,10-15
  • Negative: -1 is the last frame, -3--1 is the last three

The node parses that string, dedupes and sorts the hits, then fancy-indexes your IMAGE tensor. Output is selected_images, ready to feed img2img, a preview node, or back into a video combiner.

Two toggles keep it from silently eating mistakes: err_if_missing raises if an index is out of range, and err_if_empty raises if nothing matched. Both default to on. My advice: leave them on while you're learning the syntax, and don't be surprised by the error - it's the node telling you the truth about your index string.

Where it fits

The intended home is video work - this pack's whole reason to exist is replicating CapCut/JianYing/PR-style edits in the graph. So the natural pipeline is VHS_SplitImages → Select Images → img2img on just the frames you care about → recombine. But it's equally handy for grabbing a representative frame from a batch to check a style, or cutting a long generation down before you burn time rendering it.

Installing it

Same as every node in this pack - it's one repo, seven nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/yichengup/ComfyUI_SwiftCut

Restart ComfyUI and it shows up under YC_VideoCutHelper → Image Tools. Or use ComfyUI Manager and search "ComfyUI_SwiftCut". Dependencies are just torch/Pillow/numpy, no models to chase.

The catches

Two things people hit. First, you can't reorder frames with this node - the parser dedupes and sorts, so 3,1,5 gives you frames in original order, not your order. It's a selector, not a reorderer. Second, a mismatch like asking for 8-12 when the batch has 9 frames throws unless you flip err_if_missing off - flipping it off just silently skips the out-of-range indices. That's the escape hatch when you're selecting "as many as exist."

It's not flashy, and this pack has zero reddit presence, so you're unlikely to see it recommended anywhere. But for frame-slicing chores it's genuinely the most comfortable way I've found to do it without pulling in a heavier utility pack.

CategoryYC_VideoCutHelper/Image Tools

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
indexesSTRING0
err_if_missingBOOLEANtrue
err_if_emptyBOOLEANtrue

Outputs (1)

NameTypeDescription
selected_imagesIMAGE