Nodes/Crystools/πŸͺ› Switch image
ComfyUI Node Runs on cloud

πŸͺ› Switch image

Switch Image (Crystools)

By crystianΒ·Created 3 years agoΒ·Updated 9 months agoΒ· 1,940
πŸͺ› Switch image
  • on_true
  • on_false
  • image
β—„booleantrueβ–Ί

A one-checkbox router for images: two IMAGE inputs, one boolean, one IMAGE out. Flip the boolean and you flip which image flows downstream. That's the entire node, and that simplicity is the point.

Why you'd reach for it

Any time you want to A/B two image sources behind a single toggle instead of rewiring the graph - comparing a raw render against a post-processed one, choosing between two different upscaler outputs, or building a preview branch you can flip on and off without deleting links. Crystools ships a small family of these typed switches (string, image, conditioning, and a couple others per the README) plus a generic Switch any for everything else; this is the image-flavored one.

It's also handy for building a single reusable "final output" branch in a workflow you're iterating on - wire your work-in-progress result into on_false and a known-good baseline into on_true, and you've got a one-click way to fall back to something that definitely works while you're still fighting with a new part of the graph.

How it works

The boolean picks a branch: true routes on_true to the output, false routes on_false. Since a 2025 release the switch family evaluates lazily - only the selected branch's upstream chain actually runs, so the image path you didn't pick doesn't cost you compute. That matters more than it sounds: earlier you'd effectively pay for generating both images even though only one showed up, which defeats half the point of a switch.

Inputs and outputs

Required: on_true and on_false, both IMAGE, and boolean (default true, so out of the box it passes on_true). Output: image. There's no default for either image input - you have to wire both, or ComfyUI will complain about a missing required connection.

Installing it

Through ComfyUI Manager, search crystools. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/crystian/ComfyUI-Crystools.git
cd ComfyUI-Crystools
pip install -r requirements.txt

Restart ComfyUI. Nothing else to fetch - it's pure graph logic, no models, no heavy dependencies.

Common issues

It's strictly typed to IMAGE, so if you're trying to switch between an image and anything else - a latent, a mask, a completely different data type - this node will refuse the connection. Reach for Switch any instead when the two branches aren't the same concrete type.

The other trip-up is just remembering the default: boolean starts at true, meaning on_true fires unless you explicitly flip it or feed the toggle from somewhere else (a Primitive boolean node is the natural pairing if you want the switch state visible and reusable in one place). If you're debugging "why is it always showing the wrong image," check that widget before anything else.

Categorycrystools πŸͺ›/Switch

Inputs (3)

NameTypeDefaultDescription
on_trueIMAGEβ€”
on_falseIMAGEβ€”
booleanBOOLEANtrueβ€”

Outputs (1)

NameTypeDescription
imageIMAGEβ€”