πΌοΈ RH Image Selector
Pick one image out of a batch β RH Image Selector
- images
- image
RH Image Selector is the smallest node in the ComfyUI_RH_API pack, and it exists because of a specific annoyance: RH Execute and RH Download return images as a batch tensor - a stack of frames/samples in one IMAGE output. That's great when you want all of them and annoying when you want exactly one. This node slices one image out of the batch by index and hands it back as a single-image tensor.
It's not cloud-specific at all. The pack ships it because multi-image cloud results arrive as batches, but it'll happily index any IMAGE tensor you feed it, from any source. Think of it as a one-liner images[index] in node form.
Inputs and output
images- any batch of images. Required.index- which image to pull, 0-based, default 0, range 0β9999. Index 0 is the first image, 1 the second, and so on.
Output: image, a single-image IMAGE tensor you can feed into any normal image input - a KSampler for img2img, a Save Image node, an upscaler, whatever. It keeps the batch dimension (shape 1, H, W, C), so it drops into anything that takes an IMAGE.
How it works
Straightforward: it checks index against the batch size and raises a clear error ("Index X out of range (batch size: N)") if you go past the end, then returns images[index].unsqueeze(0). That bounds check is the whole value - a raw tensor slice would silently give you whatever garbage, while this node tells you the batch only had four images when you asked for index 7.
When you'd actually use it
The common pattern: cloud workflow returns a grid of variations, you want the second one. Run RH Execute, wire images into Image Selector with index: 1, and send that single image into your local post-processing chain. Or in a batch pipeline, select one result per batch before saving. It's a utility node - you won't build a workflow around it, but the day you need to grab "result #3 out of 8," it's the difference between a clean graph and a janky custom-slice workaround.
Gotchas
Zero-based, so the "first" image is index 0 - the classic off-by-one that gets people right after they learn about this node. And because it raises on out-of-range, don't drive it with a hardcoded index if your cloud workflow's output count varies; check the batch size first or you'll get a hard error mid-queue. There's no "last image" or "random" mode; it's a number, in, number, out.
Install is pack-wide: ComfyUI Manager (search ComfyUI_RH_API) or git clone https://github.com/xuchenxu168/ComfyUI_RH_API.git into custom_nodes + pip install -r requirements.txt, restart.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Batch of images | |
| index | INT | 00β9999 | Index of image to select (0-based) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | β |