Nodes/ComfyUI Easy Use/easy imageIndexSwitch
ComfyUI Node Runs on cloud

easy imageIndexSwitch

Pick one image out of up to 20 by number

By yolain·Created 3 years ago·Updated 9 days ago· 2,633
easy imageIndexSwitch
  • image0
  • image1
  • image2
  • image3
  • image4
  • image5
  • image6
  • image7
  • image8
  • image9
  • image10
  • image11
  • image12
  • image13
  • image14
  • image15
  • image16
  • image17
  • image18
  • image19
  • image
index0

A router. You wire up several image sources, and easy imageIndexSwitch outputs whichever one the index number points at. Set index to 0 and it passes image0; set it to 3 and it passes image3. It's the ComfyUI equivalent of a rotary selector switch - one dial, many inputs, one output.

Where this actually earns its keep is inside loops and automated graphs. Drive the index from a counter or a math node and you can march through a set of images one per iteration, or programmatically choose which pipeline branch feeds the next stage without rewiring anything.

How it works

It reads the integer on index, grabs the correspondingly-numbered input, and passes it straight through. Only the selected branch's output is used - the others are ignored for that run. Because the image inputs are optional, you only connect the ones you need; you don't have to fill all 20 slots.

The inputs and outputs that matter

  • index (INT, 0–9) - the selector. This is the one control you set or drive. Note the widget range is 0–9, even though there are input slots up to image19.
  • image0image19 - the candidate images, all optional. Connect as many as you want to choose between.
  • image (output) - the selected one.

How to install it

ComfyUI Manager: search ComfyUI-Easy-Use, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/yolain/ComfyUI-Easy-Use

then install.bat / pip install -r requirements.txt, restart. No models.

Common issues & troubleshooting

Index points at an empty slot. If index selects a slot you never connected, there's nothing to pass and the node errors (or passes nothing). Make sure the index only ever lands on inputs you've actually wired.

The slider stops at 9. The index widget maxes at 9, so if you're feeding it from a math or counter node be aware of that ceiling when you're driving it programmatically. Keep your computed index within the range of connected inputs.

It's a switch, not a combiner. This picks one image; it doesn't merge or batch them. If you want all of them together, that's easy batchAnything or easy imageListToImageBatch, not this.

Using it as a manual A/B/C preview. Totally valid - park a few candidate outputs on the inputs and flip index to eyeball each without rerouting cables. Just remember only the selected branch is what got computed for that run.

Driving it from a loop. The real payoff is automation. Feed index from an easy forLoopStart counter (or a math node) and each iteration selects the next image in the set - process image0, then image1, and so on, without any manual clicking. That's the pattern behind a lot of "run the same operation over N inputs" graphs.

Only the chosen branch runs - use that. Because the unselected inputs are ignored for the run, you can hang expensive branches off slots you're not currently selecting and they won't cost you anything until index points at them. It's a cheap way to keep several alternative pipelines in one graph and switch between them with a single number.

CategoryEasyUse/Logic/Index Switch

Inputs (21)

NameTypeDefaultDescription
indexINT00–9
image0optIMAGE
image1optIMAGE
image2optIMAGE
image3optIMAGE
image4optIMAGE
image5optIMAGE
image6optIMAGE
image7optIMAGE
image8optIMAGE
image9optIMAGE
image10optIMAGE
image11optIMAGE
image12optIMAGE
image13optIMAGE
image14optIMAGE
image15optIMAGE
image16optIMAGE
image17optIMAGE
image18optIMAGE
image19optIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE