Images Index
Grab frame 7 (or the last one) — Images Index pulls a single image out of a batch
- images
- image
A video loader gives you 60 frames in one batch and you want frame 7. A batch generator produced 24 variants and you want to inspect the last one. Images Index is the extractor: give it an image batch and an index, and it hands you back the single image at that position.
The mechanism, from the source, is one line: images[index].unsqueeze(0). The unsqueeze(0) matters more than it looks - a raw images[index] would give you a tensor missing the batch dimension, which most downstream nodes would reject. Adding the batch dimension back means the output is a proper one-image batch, so it plugs directly into anything that accepts an IMAGE - no adapter needed.
The one behavior worth learning is that indices work exactly like Python list indexing, including negatives. Index 0 is the first image, index -1 is the last image, -2 the second-to-last, and so on. That's not an accident - the default is -1, so out of the box the node grabs the final image in the batch, which is a genuinely useful default for "show me what came out at the end of this pipeline."
The inputs:
- images - the batch to index into.
- index - which image to pull, default
-1(the last one).
The output:
- image - the selected image as a batch of one.
Where it fits: any workflow that needs one frame from a sequence - pull the first or last frame of a video batch for a thumbnail or a preview, extract a specific variant from a batch for closer inspection, or single out a frame before feeding it into a node that only processes one image at a time. It's the batch-extraction counterpart to the pack's Images Range (which slices a whole span) - index for one, range for many.
The gotcha is the one you'd expect: an out-of-range index raises a runtime error, so index=60 on a 24-frame batch crashes that run. If you're indexing dynamically, guard the value upstream with a clamp or a min/max node. Negative indices are safe as long as the batch is big enough to reach them.
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 Index" or "pick image". No models, no dependencies - just a tensor index and an unsqueeze.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| index | INT | -1-9223372036854776000–9223372036854776000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |