Nodes/ComfyUI-batching-nodes/Get Image From Batch
ComfyUI Node

Get Image From Batch

Grab one image out of a batch, when you don't want all of them

By Hahihula·Created 8 months ago·Updated 5 months ago· 14
Get Image From Batch
  • images
  • image
  • index
index0

The Batch Images (Folder Loader) node runs every image in a folder, and that's usually what you want. But sometimes it isn't: you want to inspect one image, re-run a single one that came out badly, or hand exactly one frame to a node that can't handle lists. Get Image From Batch is the "show me that one" companion - it takes the batch and an index and returns a single image tensor.

How it works

Where the folder loader pushes a list out, this node pulls one item back in. It's list-aware (INPUT_IS_LIST), so it receives the whole image list in one call, then picks out the entry at index. Same two safety behaviors as the pack's prompt-side sibling:

  • 0-based indexing - index 0 is the first image.
  • Wrap-around - the real index used is index % len(images). Index 99 on a 10-image batch silently gives you image 9, so an out-of-range value never crashes the workflow.

One quirk to file away: if the list is empty, it returns a 64×64 black tensor instead of erroring. That's a deliberate placeholder, not a bug - but it will look like one if you're not expecting it.

Inputs and outputs

  • images - connect the images output of the pack's Batch Image Loader node.
  • index - INT, default 0, min 0. Set it as a widget, or drive it from another node.

Two outputs:

  • image - the single IMAGE tensor, ready for any normal image input.
  • index - the actual index that was used after wrap-around. Small detail, genuinely useful: it tells you which image you're really looking at when you've overshot the list.

Why you'd actually use it

The best pattern is pairing it with the pack's Get Prompt From Batch and sharing one index value across both. Feed the folder loader's images into one, Batch Text's prompts into the other, set the same index - and you can step through each prompt×image combination one at a time before you release the full matrix on your GPU. That's the classic "debug the workflow on one pair, then let the batch fly" move.

It's also the escape hatch for downstream nodes that choke on list inputs. If some custom node misbehaves when fed the loader's list, route a single image through this first - the list-handling problem disappears.

Installing it

It comes with the rest of ComfyUI-batching-nodes (MIT, by Hahihula). ComfyUI Manager: search "ComfyUI Batching Nodes" and install, then restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/Hahihula/ComfyUI-batching-nodes

Restart ComfyUI after either. No pip step, no model download - the pack leans only on torch/PIL/numpy, which ComfyUI already has, and registers its nodes with a Batch Image Loader Node - Loading... console banner.

Gotchas worth knowing

The wrap-around means "index 100" never errors and instead quietly lands in-range - robust, but confusing if you expected it to complain. And remember the black placeholder for empty batches; if you ever see a 64×64 black square come out of this, check the loader's count, because you're feeding it nothing. Otherwise it's about as simple as a node gets: one image in, one image out, exactly the one you asked for.

Categoryimage

Inputs (2)

NameTypeDefaultDescription
imagesIMAGE
indexINT00–10000

Outputs (2)

NameTypeDescription
imageIMAGE
indexINT