Nodes/AQnodes for ComfyUI/AQ_ImageMaskSwitch
ComfyUI Node

AQ_ImageMaskSwitch

Pick between up to four image+mask pairs with one number

By 2frames·Created about a year ago·Updated 6 months ago· 1
AQ_ImageMaskSwitch
  • images1
  • mask1_opt
  • images2_opt
  • mask2_opt
  • images3_opt
  • mask3_opt
  • images4_opt
  • mask4_opt
  • IMAGE
  • MASK
select1

A 4-way selector for image-and-mask pairs. Feed it up to four images and four masks, set select to 1–4, and it passes the chosen pair through untouched. That's the whole job - no logic, no mixing, no blending. It exists because ComfyUI graphs get ugly when you want to swap between a few variants without rewiring a dozen connections.

What it's for

Routing in multi-variant workflows, A/B testing masks, choosing between inpaint regions on the fly, or cycling through options automatically - pair it with AQ_Increment (same pack) feeding the select input and you get a node that rotates through variants every run. In the pack's own image pipeline, it's the handy way to flip between candidate images or masks mid-graph.

How it works

Pure passthrough. select picks the slot; the output pair is whatever is connected there. Slot 1 (images1) is required; slots 2–4 and all four masks are optional.

Inputs

  • select - 1 to 4, default 1.
  • images1 (required), images2_optimages4_opt (optional).
  • mask1_optmask4_opt (optional).

Outputs

IMAGE and MASK - the selected pair.

Install

Part of AQnodes:

cd ComfyUI/custom_nodes
git clone https://github.com/2frames/ComfyUI-AQnodes
cd ComfyUI-AQnodes
pip install -r requirements.txt

or search "AQnodes" in ComfyUI Manager and restart.

Gotchas

It does no validation. If you select a slot you never connected, it returns None for that output, and the downstream node fails with a confusing "attribute '…' of 'NoneType'" style error. Only select slots you've actually wired, or drive select from something that can't exceed the connected count. Also note images1 is required but mask1_opt isn't - selecting 1 can still hand you a None mask if you never connected one, which is fine as long as what's downstream tolerates a missing mask.

CategoryAQ/Image

Inputs (9)

NameTypeDefaultDescription
selectINT11–4
images1IMAGE
mask1_optoptMASK
images2_optoptIMAGE
mask2_optoptMASK
images3_optoptIMAGE
mask3_optoptMASK
images4_optoptIMAGE
mask4_optoptMASK

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK