ComfyUI Node

Image Switch

Flip between two images mid-workflow

By HavocsCall·Created 2 years ago·Updated 9 months ago· 4
Image Switch
  • Image_1
  • Image_2
  • Image
  • Selection
Selection1

Image Switch is the two-slot router for IMAGE tensors. One selection, two image inputs, one image out. It's the sort of node that sounds too boring to matter until you've got a workflow where you want to swap between two source images without deleting wires - at which point it becomes the thing you use every day.

Where you'll actually use it

The obvious cases: img2img where you want to toggle between two reference images, ControlNet where you're testing two different pose or edge inputs, or any A/B comparison of two source photos. A really common pattern is loading one image into the img2img slot and a second into a ControlNet reference, then flipping to see which combo works. Since the node's selection is an INT, you can even automate the flip - a random seed feeding Selection gives you a "random image each run" effect without any scripting.

How it works

Same DNA as every node in this pack's switch family - a match on the selection:

case 1: return (Image_1, Selection,)
case 2: return (Image_2, Selection,)

Inputs:

  • Selection - 1 or 2. Feed it an integer from anywhere, or just click between values.
  • Image_1 and Image_2 - IMAGE tensors from Load Image, a VAE decode, an upscaler, whatever produces pixels.

Outputs:

  • Image - the selected tensor. Drop it into your sampler's latent encoder, ControlNet application, or preview.
  • Selection - the choice, echoed out so downstream logic can know which source won.

Where people get burned

Same two gotchas as the other switches in this pack. Image_2 is optional - leave it empty, pick 2, and you'll hand a None to whatever's downstream, which usually surfaces as a cryptic error in the node you connected it to. Wire both inputs before you start flipping.

And remember that selecting ≠ skipping: ComfyUI computes both connected branches regardless, so Image Switch won't save you from running a slow upscaler on both images. It picks the output; it doesn't mute the loser.

One practical note on batches: each input is a full IMAGE tensor, which may contain multiple frames or a batch. The switch passes the whole thing through untouched, so batching behavior is entirely up to whatever produced the images.

Installing it

ComfyUI Manager → search "HavocsCall" → install → restart. Manual install:

cd ComfyUI/custom_nodes
git clone https://github.com/HavocsCall/comfyui_HavocsCall_Custom_Nodes

Restart and it'll be under HavocsCall/Switches. No requirements.txt, no model downloads - the pack only uses what ComfyUI already ships, so this installs in seconds.

CategoryHavocsCall/Switches

Inputs (3)

NameTypeDefaultDescription
SelectionINT11–2
Image_1IMAGE
Image_2optIMAGE

Outputs (2)

NameTypeDescription
ImageIMAGE
SelectionINT