ComfyUI Node

Shuffle Mask

The channel-picker you'll use more than you expect

By amtarr·Created 9 months ago·Updated 4 months ago· 58
Shuffle Mask
  • image
  • mask
channelred
channel_index0

Sometimes the mask you need is already sitting inside the image you have. A height map's blue channel, a metallic map's red channel, an alpha's transparency - Shuffle Mask just pulls one channel out as a black-and-white mask. That's the whole job, and it does it without ceremony.

How it works

Pick channel - red, green, blue, or alpha - and the node slices that channel out of the image and returns it as a MASK. No thresholding, no feathering, no opinions. If you ask for alpha on an image that has no alpha channel, it quietly returns a solid white mask (opaque) rather than erroring, which is a nice touch you'll appreciate when a source PNG suddenly has no transparency.

The clever bit is the optional channel_index input: connect an integer and it overrides the dropdown - 0=red, 1=green, 2=blue, 3=alpha. The dropdown is fine when you're clicking around, but a connected integer means you can switch channels programmatically, from an LLM node or a switch. Same idea as the sibling Shuffle Custom Colors node, which uses a connectable index to pick between hex colors.

When to reach for it

In the texture world it's a workhorse. Extract the red channel of an ORM-packed texture to get the AO. Pull the blue channel of a normal map for a cheap height approximation. Take the alpha out of a decal. Because the output is a real MASK, it plugs into anything that accepts masks - inpaint crops, blend masks, color masks, you name it.

Installing it

Part of amtarr/ComfyUI-TextureAlchemy. ComfyUI Manager → search "Texture Alchemy", or:

cd ComfyUI/custom_nodes
git clone https://github.com/amtarr/ComfyUI-TextureAlchemy

Restart, then right-click → Add Node → Texture Alchemist → Masks. No dependencies, no models - it's one tensor slice on ComfyUI's bundled PyTorch.

The honest gotchas

It's a raw channel extract, so there's no built-in way to clean the result up. A channel straight out of a photo will contain everything that channel contains - including baked lighting - so you'll often want to follow it with a threshold, a blur, or a contrast step. And remember the pack's console chatter: every run prints a banner, which is just the author's logging style. If you find yourself reaching for this constantly, the main thing to know is that channel_index is the input you'll actually automate, and the dropdown is the one you'll use for quick pokes.

CategoryTexture Alchemist/Masks

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
channelCOMBOredChannel to use as mask. Overridden when channel_index is connected.
channel_indexoptINT00–3Connect an integer to override the dropdown: 0=red, 1=green, 2=blue, 3=alpha (e.g. from LLM).

Outputs (1)

NameTypeDescription
maskMASK