AQ_ImageMaskSwitch
Pick between up to four image+mask pairs with one number
- images1
- mask1_opt
- images2_opt
- mask2_opt
- images3_opt
- mask3_opt
- images4_opt
- mask4_opt
- IMAGE
- MASK
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_opt…images4_opt(optional).mask1_opt…mask4_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.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| select | INT | 11–4 | — |
| images1 | IMAGE | — | |
| mask1_optopt | MASK | — | |
| images2_optopt | IMAGE | — | |
| mask2_optopt | MASK | — | |
| images3_optopt | IMAGE | — | |
| mask3_optopt | MASK | — | |
| images4_optopt | IMAGE | — | |
| mask4_optopt | MASK | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |
| MASK | MASK | — |