Nodes/ComfyUI-DeanLogic/Image Input Switch (Boolean)
ComfyUI Node

Image Input Switch (Boolean)

Two images in, one out — the boolean image switch (with a gotcha)

By MartinDeanMoriarty·Created about a year ago·Updated about a year ago· 0
Image Input Switch (Boolean)
  • image_true
  • image_false
  • IMAGE
condition

You've got two candidate images and you want exactly one of them to keep flowing down the graph, picked by a boolean. That's an embarrassingly common ask in ComfyUI, and core ComfyUI has no button for it. rgthree's Context Switch branches on which context is non-null, Impact Pack's switches are tuned for its own detect-crop-refine pipeline, and nothing stock just says "if this checkbox, use A, else use B." That's the hole ImageInputSwitch (shown in the menu as "Image Input Switch (Boolean)") tries to fill. It's one of four tiny logic nodes in ComfyUI-DeanLogic, a pack so small and new it has basically no community footprint yet - a single commit from mid-2025, MIT licensed, zero dependencies, no model files.

The mechanism is about as simple as a node gets. Wire in two IMAGEs, image_true and image_false, set the condition BOOLEAN, and it returns whichever one the condition picks. In the UI that BOOLEAN shows up as a checkbox when nothing is connected to it, or you can drive it from another node's boolean output. If the chosen image turns out to be None or an empty list, it politely returns None instead of crashing. That's the whole thing. Reach for it when a workflow genuinely has two sources - a reference photo and a freshly generated result, say - and one checkbox decides which gets VAE-encoded or saved.

Now the part nobody warns you about, and probably why you're reading this page. Look at the shipped source and the class declares FUNCTION = "switch_inputs" while the actual method is named switch_image. ComfyUI executes a node by calling the method named in FUNCTION, so the moment this node runs you get AttributeError: 'ImageInputSwitch' object has no attribute 'switch_inputs' and the whole queue dies. As of the current commit, this node is broken out of the box. The fix is a one-line edit in custom_nodes/ComfyUI-DeanLogic/image_input_switch.py:

FUNCTION = "switch_image"

Save, restart ComfyUI, done. If a workflow you downloaded uses this node and errors instantly, that typo is why.

Installing the pack is the easy part. Through ComfyUI Manager, search "DeanLogic" or "ComfyUI-DeanLogic" and hit Install, or clone it manually:

cd ComfyUI/custom_nodes
git clone https://github.com/MartinDeanMoriarty/ComfyUI-DeanLogic

Restart ComfyUI and the nodes appear under the "DeanLogic" menu category. No requirements.txt, no pip step, no model downloads - the whole pack is a few hundred lines of pure Python.

Two things to know once it runs. First, both image inputs need to be connected, or the missing one becomes None and you'll get None out. Second, the image you don't select is discarded; nothing downstream sees it. If your actual need is the opposite (one image, two destinations), that's the sibling ImageOutputSwitch in the same pack - and that one works as shipped, unlike this one. And if you'd rather not depend on a node that needed a patch at all, rgthree's Context Switch or an if built from Primitive nodes can cover the same ground with more ceremony.

CategoryDeanLogic

Inputs (3)

NameTypeDefaultDescription
image_trueIMAGE
image_falseIMAGE
conditionBOOLEAN

Outputs (1)

NameTypeDescription
IMAGEIMAGE