ComfyUI Node

Image Switch

Stop rewiring your graph to swap an image

By benstaniford·Created about a year ago·Updated about a year ago· 1
Image Switch
  • image_1
  • image_2
  • image_3
  • image_4
  • image_5
  • image_6
  • image_7
  • image_8
  • image
select1

The situation: you've generated four variants and you want to try each one through the same upscaler, or you want to flip between two source images feeding a ControlNet stage without unplugging a single wire. That's this node's whole reason to exist. Image Switch (class ImageSwitchNode) from the tiny benstaniford/comfy-image-switch pack takes up to eight images in and puts exactly one out, picked by an integer.

It's the humble cousin of the switch nodes in the big quality-of-life packs like rgthree-comfy - the ecosystem has a whole genre of these things for keeping a large graph workable instead of rebuilding it every run. What Image Switch has over those is that there's nothing to learn: no context bundles, no special types, no frontend magic. One dial, one output.

How it works

The mechanism is as simple as the interface. A required select integer (default 1, range 1–8) names the slot you want, and the node copies that slot's image to its image output. What makes it friendlier than a raw copy is the fallback behavior the README spells out:

  • If the slot you selected is empty, it quietly falls back to the first connected image.
  • If nothing is connected at all, it outputs a black 512×512 image instead of erroring.

That second one is worth remembering, because it means an empty node doesn't throw an error that tells you something's wrong - it gives you a black square.

Inputs and outputs

Only a few things matter here, and two of them are optional:

  • select - the only widget. An integer from 1 to 8. This is 1-indexed, not 0-indexed; if you come from any programming background, the first image lives in slot 1, not slot 0.
  • image_1 through image_8 - optional IMAGE inputs. Wire Load Image, another sampler's output, anything that produces an IMAGE tensor.
  • image (output) - the chosen IMAGE, wired into whatever consumes an image next.

You can leave slots empty and it's fine - that's the whole point of the fallback. You can also drive select from any node that outputs an integer to switch images dynamically during a batch, which is how this becomes a poor man's image queue.

Installing it

This is about as painless as a custom node gets. The README lists no model files and no dependencies beyond ComfyUI, PyTorch, and Python 3.8+ - there's no requirements.txt rabbit hole, nothing to download.

The easy way is ComfyUI Manager: search for "ComfyUI Image Switch Node" or comfy-image-switch and install it from the registry. The manual way, which is what the README documents, is:

cd ComfyUI/custom_nodes
git clone https://github.com/benstaniford/comfy-image-switch

Then restart ComfyUI. (The README's own clone command has a yourusername placeholder in it - use the real repo above.)

Common issues

There isn't a long list of failure modes because the node is barely long enough to have bugs, but a few things do trip people up:

  • You selected 0 (or 9) and got the fallback image. The valid range is 1–8, so an out-of-range pick silently gives you the first connected image instead of an error. If the "wrong" image keeps appearing, check the select value first.
  • A black 512×512 image showed up. That's the "no images connected" fallback, not a bug. The node chose not to crash; it just has nothing to give you.
  • It's a small single-maintainer pack. There's essentially zero community chatter about it on Reddit, so you're mostly self-supporting. That's fine - the whole pack is a couple hundred lines - but don't expect tutorial threads or rapid updates. It does one thing, and for a workflow-hygiene utility that's usually enough.
Categoryimage/switch

Inputs (9)

NameTypeDefaultDescription
selectINT11–8
image_1optIMAGE
image_2optIMAGE
image_3optIMAGE
image_4optIMAGE
image_5optIMAGE
image_6optIMAGE
image_7optIMAGE
image_8optIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE