Mask Composite Advanced (MEC) (legacy)
The eight-operation mask combiner that got retired
- mask_a
- mask_b
- MASK
The short version
This node combines two masks into one with a compositing operation. It is also deprecated - the pack keeps it registered under a "legacy" category so workflows saved a year ago still load and still run, and the node's own description points you at ComfyUI's core MaskComposite as the closest living relative.
So: if you are starting fresh, do not build on this. If a workflow you downloaded is throwing "node not found" or a red box, this is one of the seven legacy nodes that exist to stop that happening, and you are in the right place.
What it does
Two MASK inputs, mask_a and mask_b, one MASK output - and eight operations:
union(max of both),intersect(min),subtract(A minus B),xor,differencemin/maxper-pixelblend, which is the only one that usesblend_factor(0 = all A, 1 = all B, per the author's tooltip)
On top of that, invert_a and invert_b flip either input before the operation, and threshold binarizes the result - 0 keeps the soft values, anything higher snaps everything to black and white. That threshold field is genuinely useful, because a thresholded matte is what a lot of latent-mask inputs actually want.
The mechanics are the kind of thing that sounds boring until it bites you: masks arrive as batch-of-H×W tensors, so the node pads batch counts by repeating frames and, if the two masks differ in size, bilinearly resizes B to match A. Silently. A mismatched mask does not error here - it stretches, and you only find out from the soft blob in the output.
Why you'd still use it
Compositing masks is how you build a real selection instead of a lucky one. Take a SAM or BiRefNet subject matte, union it with a painted frame from the pack's own draw nodes and you have the full region you want to repaint. Intersect a luminance key with a face mask and you have a highlight. Subtract a rough background mask from a foreground mask and you have a hole to fill.
The KB's framing of detailing helps here - "all detailers are doing is zooming in on a mask, upscaling the image, and then diffusing the upscaled image to add details. You can get that mask in SO many ways." This node is one of the ways you get that mask.
Install
cd ComfyUI/custom_nodes
git clone https://github.com/Code2Collapse/ComfyUI-CustomNodePacks.git
Or ComfyUI Manager → "CustomNodePacks", then restart. A healthy load prints:
[C2C] CustomNodePacks: 142 nodes loaded (...) - 0 failed
The pack's required packages are three, and ComfyUI already ships torch and numpy, so install deliberately rather than running the whole requirements file over your install:
pip list | grep -i "opencv\|scipy\|safetensors"
pip install opencv-python>=4.7.0 scipy>=1.10.0 safetensors>=0.4.0
What to use instead
- Core
MaskComposite- the built-in node, fewer operations, zero extra install. Ifmultiply,add,subtract,and,ororxorcovers you, reach for that one. MaskBatchCombineMECfrom the same pack's helpers -union,intersect,diff,xor,add,subtract. It does not auto-resize and it raises on a shape mismatch, which is arguably better behaviour than quietly stretching your mask.- New graphs should work in whatever the pack now calls its current mask nodes. Legacy here means frozen code, not a hidden feature.
Where people get burned
- The silent resize. If the two masks are different resolutions you get a plausible-looking wrong answer. Check sizes before you blame the model.
blend_factorlooks dead. It is - every operation exceptblendignores it.thresholdat 0 is not "threshold at 0". Zero means disabled, so soft edges survive. Any value above it hardens the matte; going back to 0 is how you undo that.- Batch length surprises. Unequal batches get padded to the longer one, so a single-frame mask against a 20-frame batch comes back as 20 frames of the same thing. Usually what you want, occasionally not.
- It is legacy for a reason. Every minute you spend debugging this node in a new graph is a minute spent on code the author has already declared finished, from a pack whose author - a compositor who announced it on r/comfyui in May 2026 - has moved the active mask work into the newer unified nodes.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| mask_a | MASK | — | |
| mask_b | MASK | — | |
| operation | COMBO | union | 8 options: union, intersect, subtract, xor, blend, min, +2 |
| blend_factor | FLOAT | 0.500–1 | Blend ratio (only for 'blend' mode). 0=all A, 1=all B |
| invert_a | BOOLEAN | false | — |
| invert_b | BOOLEAN | false | — |
| threshold | FLOAT | 0.000–1 | Binarize output (0 = keep soft) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MASK | MASK | — |