Nodes/ComfyPanel/ImageSwap
ComfyUI Node

ImageSwap

The two-port image flip, and nothing else

By Ginolazy·Created 6 months ago·Updated 2 days ago· 23
ImageSwap
  • image_a
  • image_b
  • output_image_a
  • output_image_b
swapfalse

ImageSwap is the minimal member of the ComfyPanel switch family: two images in, two images out, one boolean. When swap is off, image_a comes out of output_image_a and image_b out of output_image_b. Flip it on and they trade places. That's the entire node - it's a two-port A/B image switch with nothing else attached.

Its reason to exist is the same as the pack's ImageMask_Swap, minus the masks. If you have two candidate images - two reference frames, a base and a variant, a source and a result - and you want to toggle which one flows to which downstream consumer, this is the node. Because it swaps both directions simultaneously (A's output becomes B's input position and vice versa), it's the clean way to flip a pairing between two consumers: swap the images once and both downstream nodes get the other one, no re-wiring. A single boolean widget controls both outputs, so you toggle one thing and both sides follow.

The schema is exactly image_a, image_b, swap, and the two outputs. Both inputs are required, both outputs are IMAGE. There's no lazy execution and no automatic selection: whatever you feed it, it computes (trivially) and passes through. It's eager, deterministic, and impossible to get wrong - the whole node is an if statement.

Honest positioning: you don't strictly need this node, because you can build the same flip with two core ComfyUI ImageSwitch nodes wired in the right directions. What you get here is the convenience of the pairing held together in one place - one widget, two outputs, no chance of swapping one wire and forgetting the other. For the version that also carries masks along, that's ImageMask_Swap. For the version that only executes the branch you pick (so the losing branch doesn't run), that's ImageMask_Switch. This one is the plain, no-features, works-everywhere option.

Where it shows up in practice: toggling between two inputs in a comparison preview, flipping a before/after pair between two viewer nodes, or choosing between two source images feeding an edit pipeline. It's a small node for a small job, and some weeks the small job is the one that's been annoying you.

Installing it

cd ComfyUI/custom_nodes
git clone https://github.com/Ginolazy/ComfyPanel
# restart ComfyUI

or ComfyUI Manager → "ComfyPanel". No models, no dependencies beyond the pack's standard stack. There's genuinely not much to troubleshoot here - if the swap "doesn't work," check that the swap boolean is actually the widget you think it is, and that you're reading the correct output ports for your downstream wiring.

CategoryComfyPanel/Image or Mask

Inputs (3)

NameTypeDefaultDescription
image_aIMAGE
image_bIMAGE
swapBOOLEANfalse

Outputs (2)

NameTypeDescription
output_image_aIMAGE
output_image_bIMAGE