Nodes/Tojioo Passthrough/Any Image Switch
ComfyUI Node

Any Image Switch

The first-non-null image switch you'll actually use

By Tojioo·Created 11 months ago·Updated 7 months ago· 13
Any Image Switch
  • image_1
  • image

Any Image Switch routes one of several IMAGE sources to its image output, and it picks by slot order rather than a toggle: first connected input wins. If you've built anything with alternative image branches - two upscaler paths, a post-process on/off, an inpaint region feeding a second pass - you've hit the moment where you want one consumer fed by whichever branch is live.

The fallback-switch idea is standard fare in ComfyUI, popularized by rgthree's Any Switch: no selector, first non-null input wins, so the graph decides itself. This one is the same concept, typed to IMAGE, so the socket literally can't accept anything that isn't an image.

How it works

The node starts with image_1. Wire a second image source and an image_2 slot appears; keep wiring and the slots keep growing. At execution it grabs every connected input that isn't None and passes through the one in the lowest-numbered slot. The None skip is the part that makes this useful: muted and bypassed upstream nodes deliver None, so muting the branch feeding image_1 automatically lets image_2 win. Leave everything unconnected and it throws a "no inputs connected" error on the canvas instead of silently dropping your image.

Where you'd use it

  • Two upscale paths, one feed. Linear vs. model upscaler into a detail pass; mute one branch, done.
  • Inpainting branches. Masked region image vs. original depending on which pass is running.
  • Fallback routing. Primary source first, fallback second, and the graph picks for you.

Install

ComfyUI Manager → search "Tojioo Passthrough" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/Tojioo/tojioo_passthrough.git

Restart ComfyUI. No models to download and no pip dependencies - the pack is lean Python plus a bundled frontend, and it's on the Comfy Registry under publisher tojioo.

Common issues

Slot order is everything: a live image_1 always beats image_2, so if the "wrong" image flows through, the earlier slot's upstream is muted, bypassed, or unwired - and muting is the intended switch. Also remember the images aren't combined, just selected; if you want several images merged into one batch, that's this pack's Any Image Batch Switch instead. Keep at least one slot wired, or the node errors - that's the design, not a bug.

CategoryTojioo Passthrough/Dynamic Nodes/Switch Nodes

Inputs (1)

NameTypeDefaultDescription
image_1optIMAGE

Outputs (1)

NameTypeDescription
imageIMAGE