๐ผ๐ Select an Image, Pick
Grab one specific image out of a list by number
- all_images
- selected_image
Once you're working with lists of images in ComfyUI - a batch from a loop, a folder load, a grid split - you eventually need to pull just one back out to work on individually: preview it, save it separately, feed it into a single-image node that doesn't understand lists. This node is that step. Feed it a list of images and a number, and it hands back exactly one.
How it works
It's deliberately simple: all_images takes the whole list, selection takes an integer, and the output is a single IMAGE - the one at that position. The author pairs it in the README with the pack's "Load Images from folder" node (which splits a folder into a list by resolution) and "Preview" nodes, and that's the intended flow: load a batch, preview what you've got, then pick the one that's actually good.
It's also composable into a reusable unit. The README shows this combination - load, select, preview - turned into a single custom group node via ComfyUI's "Convert to Group Node," so you're not re-wiring the same three nodes every time you want to eyeball one image from a batch.
The inputs and outputs that matter
all_images(required, IMAGE) - the list to pick from. Has to already be a list - a single image with nothing else won't give you anything meaningful to select between.selection(required, INT, default1) - which position to grab. The default of1(not0) suggests the node counts from the first image as position one rather than zero, so treat it as 1-indexed unless your own testing shows otherwise.- Output
selected_image(IMAGE) - a single image, ready to plug into anything that expects one image rather than a list.
How to install it
ComfyUI Manager โ search Bjornulf_custom_nodes โ install โ restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/justUmen/Bjornulf_custom_nodes
pip install -r Bjornulf_custom_nodes/requirements.txt
Pure image-list indexing, no special dependency of its own - but it's part of the shared pack, so install the full requirements.txt rather than trying to isolate just this node.
Common issues & troubleshooting
It only returns one image and I expected the whole batch to keep flowing. That's the entire point of this node - it collapses a list down to a single item. If you want the rest of the batch to keep going through the graph too, don't route everything through this node; branch off a copy of the list before you select, or use it only where you genuinely want one specific result.
selection is out of range. The list only has as many items as your upstream loop or folder load produced. If you set selection higher than the list length, you'll either get an error or unexpected behavior depending on how the upstream list was built - check the actual count (a Show node on the list length, or just counting your source images) before hardcoding a number.
I'm not sure if selection: 1 means the first or second image. The default value of 1 strongly implies 1-indexed (first image = 1), which matches the general feel of the pack's other position-based nodes, but if your results look off by one, that's the first thing to check - try selection: 0 and compare.
This feels like overkill for one image. It is, if you're only ever handling a single image at a time. It earns its keep specifically once you're producing lists - from a loop node, a folder load, or a grid split - and need to peel one result back out for individual treatment.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| all_images | IMAGE | โ | |
| selection | INT | 1-999999โ999999 | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| selected_image | IMAGE | โ |