Select Images (Bounds Safe)
VHS SelectImages, minus the crash
- image
- image
- selected_count
- skipped_count
If you've built a video workflow, you know VideoHelperSuite's SelectImages - it's the standard way to pick frames out of a batch by index. You also may know its one infuriating bug: with err_if_missing=False (the way most people run it), out-of-bounds indices slip past the check and crash the tensor indexing step with a raw IndexError. Select Images (Bounds Safe) is a drop-in replacement that fixes exactly that, and adds nothing you have to learn.
It parses the same VHS-style index syntax - "3", "0,2,5", "2:8", "0:10:2", "-1" for the last frame, or mixed like "0,2:4,-1" - but filters the results against the actual batch size before touching the tensor. Out-of-range indices get silently skipped instead of blowing up your graph. You swap the node, keep your workflow's existing index strings, and the crash stops.
Why you'd reach for it
The classic case is grabbing the last frame of a video: "-1" in a SelectImages node is a real, widely-used trick for "final frame, please." But it only works while the batch has the length you assumed. The moment a video comes back a few frames shorter than expected - different source, a dropped frame - -1 still resolves fine, but a hardcoded "240" turns into a crash. This node turns that crash into a skipped index, and reports exactly what it did via the count outputs. For batch video analysis it's also a nice safety net: build your index list once, let frame counts drift, never re-trip the graph.
Inputs and outputs
image- the IMAGE batch to select from.indexes- the string expression, VHS syntax exactly as you're used to.err_if_bad_index(default False) - True means out-of-range indices raise anIndexErrornaming the offenders; False means they're skipped silently.err_if_empty(default False) - raise if nothing valid survives the filter.fallback_on_empty(defaultfirst_frame) - when no valid indices remain:first_framereturns frame 0,all_framesreturns the whole batch,blankreturns a black frame.
Outputs: image (the selected frames, in the order you listed them), selected_count, and skipped_count - the last two exist precisely so you can see when a "silent skip" is actually eating your data.
Installing it
Same install as the rest of the pack, and again: this node needs no Claude Code, no login, no API key - it's pure tensor slicing. Search ComfyUI Manager for "Claude CLI (Vision+Text)" or clone:
cd <ComfyUI>/custom_nodes
git clone https://github.com/RandyHaylor/comfyui-claude-cli-vision-text-node.git
Restart, hard-refresh the browser tab (Ctrl+Shift+R). No pip install - the pack's only dependencies are numpy, torch, and Pillow, all already in ComfyUI.
The traps
- With
err_if_bad_index=False(the default), a typo in your indexes silently drops frames - no error, just a shorter output. Theselected_count/skipped_countoutputs are there to catch exactly this; glance at them once if anything looks off. fallback_on_emptydefaults tofirst_frame, so an empty selection quietly hands you frame 0. That can look like a bug when it's actually the intended safety behavior - change it toblankif you'd rather see an obvious black frame than a plausible-but-wrong one.-1still means "last frame," and negative indices are resolved against the actual batch length, which is what makes the bounds-safe behavior feel so seamless in practice.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| indexes | STRING | 0 | — |
| err_if_bad_index | BOOLEAN | false | — |
| err_if_empty | BOOLEAN | false | — |
| fallback_on_empty | COMBO | first_frame | 3 options: first_frame, all_frames, blank |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| selected_count | INT | — |
| skipped_count | INT | — |