Nodes/MultiBand/Compose Multiband
ComfyUI Node

Compose Multiband

Stack every mask you own into one multiband image

By PozzettiAndrea·Created 9 months ago·Updated 22 days ago· 5
Compose Multiband
  • input_1
  • input_2
  • input_3
  • input_4
  • input_5
  • input_6
  • input_7
  • input_8
  • multiband
channel_names

Compose Multiband is the node you reach for the moment you have three separate masks that are really one stack. Say SAM gave you a mask for the person, another for the car, another for the sky, and you want to save them as a single multi-channel file instead of juggling three wires forever. This node is the gluing station: it takes up to eight inputs of mixed types and stacks their channels into one MULTIBAND_IMAGE.

The wider ComfyUI habit is to treat a mask as its own little tensor and pass it around alone. That works until you have a dozen of them, at which point every downstream node gets a wire for each. Multiband's answer is a custom type that holds any number of channels in one object - samples as a (B, C, H, W) tensor plus a list of channel names. Compose is how you build that object from ordinary ComfyUI data.

How it works

Each input gets normalized to channels, then all of them are concatenated along the channel axis:

  • a MASK (B, H, W) becomes one channel,
  • an IMAGE (B, H, W, 3) becomes three channels named input_N_R/G/B,
  • an existing MULTIBAND_IMAGE contributes all of its channels.

There's one hard rule the node enforces: every connected input must match the first one's batch size and spatial size. Mix a 512×512 mask with a 768×768 image and it throws a "Spatial size mismatch" error rather than silently producing garbage. That's the right call - resize first.

The channel_names widget (comma-separated) is optional; leave it empty and the node auto-names everything channel_0, channel_1, and so on. Give it names when you know what the channels mean, because the pack's other nodes can select by name - Select Multiband Channels takes R,G,B, and Multiband to Masks can auto-find anything with "mask" in its name.

The inputs that matter

  • input_1 through input_8 - any of MASK, IMAGE, or MULTIBAND_IMAGE. All optional; only input_1 is expected, but honestly just wire what you have.
  • channel_names - name the stack in one shot. If you supply fewer names than channels, the rest get auto-filled.

Output is a single multiband you can hand straight to Save Multiband Image (npz or tiff keeps the names) or to any other node in the pack.

Installing the pack

This ships in ComfyUI-Multiband. Easiest route is ComfyUI Manager - search "ComfyUI-Multiband" and install. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-Multiband.git
pip install -r ComfyUI-Multiband/requirements.txt

Then restart ComfyUI. It needs numpy, torch, and tifffile (that one's for TIFF round-trips). No model downloads - this pack does pure tensor math, no neural nets anywhere. If you want .exr support you'll also pip install OpenEXR Imath yourself; it's optional and skipped if absent.

Where people trip

The mismatch errors are the main one - Compose refuses to mix resolutions or batch sizes, so get everything to the same size first (there's a Resize Multiband in the same pack for exactly this). Also remember the batch dimension is real: a mask batch of 4 is not four channels, it's one channel across four batch slots, and Compose will compare those batches across inputs. When in doubt, check the console - the node prints how many channels it created and from how many inputs.

Categorymultiband/compose

Inputs (9)

NameTypeDefaultDescription
input_1opt*First input (MASK, IMAGE, or MULTIBAND_IMAGE)
input_2opt*Second input (optional)
input_3opt*Third input (optional)
input_4opt*Fourth input (optional)
input_5opt*Fifth input (optional)
input_6opt*Sixth input (optional)
input_7opt*Seventh input (optional)
input_8opt*Eighth input (optional)
channel_namesoptSTRINGComma-separated channel names (optional, auto-generated if empty)

Outputs (1)

NameTypeDescription
multibandMULTIBAND_IMAGE