Nodes/ComfyUI_Gemini/πŸ”’ Gemini Select Image From List
ComfyUI Node

πŸ”’ Gemini Select Image From List

Pick one native-size image out of a list

By aarnoatchiΒ·Created 2 months agoΒ·Updated 2 months agoΒ· 0
πŸ”’ Gemini Select Image From List
  • images
  • selected_image
  • selected_index
  • count
β—„index0β–Ί
β—„out_of_rangeclampβ–Ί

Gemini Select Image From List picks one image out of an image list by index and keeps its native dimensions. It looks like a twin of Gemini Image Select, and the difference is the whole point: Image Select works on a batch (one tensor, all images same size), this works on a list (each image its own size), and it's the one you want whenever your images have mixed dimensions.

Local, no API, no key. It's part of the pack's list/batch trio (with List Passthrough and List β†’ Batch Padded), and all three exist because ComfyUI's batch type is one shared-HΓ—W tensor, which makes mixed-size images a genuine engine constraint rather than a node quirk. If you have a list of crops at different resolutions and you want to grab one and keep its exact size, this is the node.

How it works

With INPUT_IS_LIST, ComfyUI hands the node the entire list at once, not one image at a time. The node flattens what it receives (splitting any stray batches into individual images, dropping Nones), then indexes in: index 0 is the first image. Out-of-range handling matches the pack's other selectors - out_of_range of clamp returns the last image, wrap cycles (index 5 in a list of 3 β†’ image 2).

Outputs: selected_image (as a single-image IMAGE, at its native resolution - nothing resized, nothing padded), selected_index (the resolved index after clamping/wrapping), and count (how many images the list actually held). The count output is quietly useful: wire it into whatever drives index and you can clamp or randomize over the true list length instead of hardcoding a number that drifts as the list changes.

Which one do I use - batch or list?

This is the pack's one genuinely confusing pair, and the README settles it in a sentence: if your images share dimensions, a batch selector (Gemini Image Select) is fine; if they don't, use the list one. Practically: mixed-size crops out of a mask-based crop node, assorted reference photos, varied product shots - list. Uniform frames from a grid or a single-size loader - batch. Feed a list of mixed sizes into a batch selector and you'll be fighting the engine over a shape error; feed them into this node and it just works.

And don't forget the third sibling: if you need the whole list as a batch downstream, List β†’ Batch Padded gets you there by padding instead of resizing; if you need the list to stay a list, List Passthrough formalizes that.

Install

Same pack, same story: ComfyUI Manager search "ComfyUI_Gemini", or git clone https://github.com/aarnoatchi/ComfyUI_Gemini into custom_nodes and pip install -r requirements.txt. No scipy, no key, nothing extra. Under AI/Image Analysis/Google after restart.

The failure mode to watch for is subtle: because downstream nodes auto-iterate over lists in ComfyUI, wiring a list into a node that expects a batch can silently process one item at a time instead of erroring - so if a downstream node is running N times when you expected once, that's the list/batch boundary telling you something. This node hands you a clean single image precisely so you can cross that boundary intentionally.

CategoryAI/Image Analysis/Google

Inputs (3)

NameTypeDefaultDescription
imagesIMAGEAn image LIST (mixed dimensions allowed). Index 0 is the first.
indexINT00–4095Which image to pick from the list (image 0, image 1, ...).
out_of_rangeoptCOMBOclampWhen index is past the end of the list: clamp β€” return the last available image wrap β€” wrap around (index 5 in a list of 3 β†’ image 2)

Outputs (3)

NameTypeDescription
selected_imageIMAGEβ€”
selected_indexINTβ€”
countINTβ€”