Is Mask Empty
Did the detector actually find anything?
- mask
- boolean
Automatic masking has one failure mode above all others: the detector finds nothing, hands you an all-zero mask, and the downstream inpaint cheerfully re-renders the entire image as if that were the plan.
What it is
One MASK input, one BOOLEAN output, named boolean. It answers a single question - is this mask missing, or is every pixel zero? - and it answers it before the expensive part of the graph runs.
That's the whole value. Any automated pass that depends on a detection (a face pass, a SAM-prompted subject, a hand detailer) has a "nothing found" branch, and without a way to detect that state the graph takes the wrong one silently.
How it works
True when the mask is None or every value in it is 0. So it's a strict emptiness test, not a quality test:
- A mask from a detector that found nothing → all zeros →
True. - ComfyUI's placeholder mask - the all-zero 64×64 tensor LoadImage returns for an image with no alpha channel - →
True. That's the behaviour you want, and it's the reason this node reads as useful rather than pedantic. - A mask with a single stray pixel somewhere → not empty →
False. The detector technically found something.
Because the input is required, it cannot answer the question when the wire is missing entirely: bypass the upstream loader and you don't get True, you get a validation error about a missing input. Keep the chain alive and let the mask be empty.
Wiring it
The output is a BOOLEAN, so it goes where booleans go: a switch node's selector, a comparison node, anything with a converted boolean input. The pattern is:
SAM / detector -> mask -> Is Mask Empty -> boolean -> (gate the detail pass)
If the mask is empty, the detail branch should be skipped. If it isn't, the branch runs and the reference to the "detect, crop, re-render, paste back" loop applies in full - and the mask blur and denoise rules from inpainting apply with it, because past detection that's exactly what this is.
One thing it can't do: drive Auto Bypass. The frontend can only read a value that exists as a widget on the canvas, so a boolean computed during execution can't resolve there - the same pack's Auto Bypass will report force unresolved and fall back to watching its source. Use this in the execution graph, not in the frontend's decision layer.
Installing it
ComfyUI Manager → search ComfyUI-BCNodes → install → restart. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/0xBeycan/ComfyUI-BCNodes
pip install -r ComfyUI-BCNodes/requirements.txt
The mask nodes live under BCNodes/mask. requirements.txt installs postfx and caption-audit for other nodes in the pack; this one needs nothing beyond a normal ComfyUI install. Reload the browser tab after restarting so the frontend half of the pack loads too.
Where people get burned
"Empty" is not "bad". A mask that covers the whole frame is not empty and will pass. So will a mask around a rock formation that a face detector decided was a face - the standard failure of automated detailing. This node tells you nothing happened; it doesn't tell you the right thing happened.
A near-empty mask is not empty. One pixel of noise defeats the check, and then the detail pass runs on a mask with no meaningful region in it. If your detector is noisy, pair this with a mask cleanup - filling holes, or a grow/shrink pass - rather than trusting it as-is.
Zero and near-zero are different things to a float mask. If a mask is written as 1e-7 everywhere instead of 0, the == 0 test says "not empty" and you'll spend twenty minutes wondering why.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| boolean | BOOLEAN | — |