Images Range
Slice a batch like a Python list — Images Range trims frames with optional start and end
- images
- images
Your video loader spat out 200 frames and you only want frames 50 through 100. Or your batch generator produced a long strip and you want to drop the first few and the last few before processing the rest. Images Range is the slicer: it cuts an image batch down to a sub-range, with optional start and end boundaries that you can switch on independently.
The mechanism is a slice, and the source is refreshingly honest about it: the node literally does images[start:end] - with a twist. Each boundary has a boolean switch: use_start gates whether start is applied, use_end gates whether end is applied. If a switch is off, that bound is None, meaning "don't trim this side." That's why the defaults work the way they do: use_start and use_end both default to false, so out of the box the node is a pass-through - it returns the whole batch unchanged. You opt into trimming per side.
The inputs:
- images - the batch to slice.
- start - the start index, applied only if
use_startis on. - use_start - switch for the start bound.
- end - the end index, applied only if
use_endis on. - use_end - switch for the end bound.
The output:
- images - the sliced batch.
Because this is a Python slice, all the usual semantics apply: end is exclusive (so start=50, end=100 gives frames 50 through 99), and negative values count from the end of the batch. Need to drop the first 10 frames of a 200-frame batch? Set start=10 and flip use_start on. Need the last 30? Leave start off and set end=-30 with use_end on - negative end keeps everything except the final 30.
Where it fits: any batch-trimming need - cutting dead frames off a video sequence before upscaling, isolating a middle segment of a batch for processing, or pulling a sub-range out to feed a different node than the full batch. It's the "many" counterpart to the pack's Images Index, which grabs a single frame.
Honest gotchas: slicing doesn't validate your bounds, so start beyond the batch length yields an empty tensor rather than an error - downstream nodes may then fail confusingly, so keep your indices sane. And both switches off is a silent pass-through, which is easy to mistake for a bug if you set values and forget to flip the switches. The node does exactly what the source says: nothing until you tell it to.
Install is the standard pack path: ComfyUI Manager → search ComfyUI-FairLab → install → restart:
cd ComfyUI/custom_nodes
git clone https://github.com/yanhuifair/ComfyUI-FairLab.git
cd ComfyUI-FairLab
pip install -r requirements.txt
Restart, search "Images Range" or "batch slice". No models, no dependencies - just a slice.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| start | INT | 0-9223372036854776000–9223372036854776000 | — |
| use_start | BOOLEAN | false | — |
| end | INT | -1-9223372036854776000–9223372036854776000 | — |
| use_end | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |