Nodes/comfyui-mixlab-nodes/Area To Mask ♾️Mixlab
ComfyUI Node Runs on cloud

Area To Mask ♾️Mixlab

Turn a transparent RGBA region into a plain mask

By MixLabPro·Created 3 years ago·Updated 2 months ago· 1,859
Area To Mask ♾️Mixlab
  • RGBA
  • MASK

AreaToMask does one small, useful thing: it takes an RGBA image and turns its non-transparent region into a MASK. That's the whole node. If you've got a cut-out - a subject on transparency from background removal, or a shape you built in the mixlab layers system - and you now need a standard ComfyUI mask of where that shape is, this converts the alpha into exactly that.

Why you'd want it: masks are the currency of half of ComfyUI. Inpainting wants a mask. Regional conditioning wants a mask. Compositing wants a mask. But a lot of the time what you actually have is transparency - an alpha channel, not a mask. AreaToMask bridges that gap. It's the minimal sibling of the pack's ImageCropByAlpha: where that one crops and hands back coordinates and multiple mask flavors, this just gives you the mask and nothing else. When the mask is all you need, this is the leaner pick.

How it works

It reads the alpha channel of the RGBA input and emits a mask where the opaque pixels are the masked region and the transparent pixels are not. Straight alpha-to-mask conversion - no thresholds to fuss with, no bounding box, no extra outputs.

The inputs and outputs that matter

  • RGBA (RGBA) in - the transparency-carrying image. This is the pack's own RGBA type, so it wants an RGBA source from within mixlab (its transparent-image / rembg-style nodes), not a bare IMEGE without alpha.
  • MASK out - the resulting mask. Wire it into an inpaint node's mask input, a regional prompt, a Set Latent Noise Mask, or a composite.

That's the entire surface, which is the point.

How to install it

Via ComfyUI Manager: search comfyui-mixlab-nodes, install, restart. Or clone the pack:

cd ComfyUI/custom_nodes
git clone https://github.com/shadowcz007/comfyui-mixlab-nodes.git

then pip install -r requirements.txt (or install.bat on the Windows portable build) and restart. If you're producing the RGBA upstream with the pack's rembg node, that needs its models in models/rembg.

Common issues & troubleshooting

It won't accept my image. The input is the RGBA type, not a standard IMAGE. If ComfyUI refuses the connection, you're handing it an image without a real alpha channel. Route it through a background-removal / transparent-image node first so there's actual transparency to convert.

The mask is solid (everything masked) or empty (nothing masked). That means the alpha isn't doing what you think. A fully-opaque input yields an all-white mask; a fully-transparent one yields nothing. Check the upstream matte actually separated subject from background - a failed removal that left a solid background produces a solid mask.

Edges look harsh. This is a direct conversion, so a hard-edged alpha becomes a hard-edged mask. If you want a soft transition for inpainting or compositing, feather the mask afterward (the pack's FeatheredMask, or any blur-mask node) rather than expecting this node to soften it.

Wrong node for a plain IMAGE. If you're starting from a normal photo with no transparency and want a mask of a subject, you need a segmentation/removal step first (rembg, SAM, a matting node) to create the alpha - AreaToMask only converts an alpha that already exists.

Category♾️Mixlab/Mask

Inputs (1)

NameTypeDefaultDescription
RGBARGBA

Outputs (1)

NameTypeDescription
MASKMASK