Detect Transparency
Detect Transparency – ComfyUI Node Guide
- mask
- INT
What it is
A one-purpose logic gate: look at a mask, decide whether it has any transparency at all, and output a number telling the rest of your graph which case you're in. That's it. It's not a creative node - it's plumbing, meant to sit upstream of a switch or branching step so your workflow can behave differently depending on whether the image you're working with actually has an alpha channel worth acting on.
You'd reach for this any time a workflow processes a mix of images - some with real transparency, some flat - and you want automatic branching instead of manually checking and rewiring every time. Pair it with a switch node so your graph routes transparent and opaque images down different paths without you babysitting it.
How it works
Per the pack's own description, it treats any non-zero value anywhere in the mask as evidence of transparency. If it finds any, it outputs 1. If the mask is entirely zero - no transparency anywhere - it outputs 2. No thresholding, no percentage, no "mostly transparent" nuance: it's a pure any-nonzero-value check.
That 1 vs. 2 convention (rather than the more familiar 0/1 boolean) isn't an accident worth overthinking - this same pack's Select ControlNet and Select Model 20 nodes both use 1-indexed integer selectors to pick between numbered slots. An INT output of 1 or 2 slots directly into a two-option switch node's "select" input without any conversion, which is almost certainly the intent here: wire this straight into a switch and let the output pick the branch.
Inputs and outputs
- mask – the MASK to check.
- output – a single INT:
1if any transparency was detected,2if none was.
That's the entire interface - one input, one output, no configuration to tune.
Installing it
Comes with the rest of the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/Shadetail/ComfyUI_Eagleshadow
Or install "Eagleshadow Custom Nodes" through ComfyUI Manager. No models, no extra dependencies - this is a pure mask check.
Common issues
Don't wire this into something expecting a boolean. If whatever's downstream expects True/False or 0/1, you'll need to convert - this node speaks in 1/2, matching the 1-indexed switch convention this pack uses elsewhere, not standard boolean logic.
"Any non-zero value" is a low bar. A single stray pixel of near-invisible transparency anywhere in the mask flips this to "detected." If your source images have compression artifacts or slight edge anti-aliasing bleeding a faint alpha value in, you may get 1 more often than you'd expect from eyeballing the image. If you need a meaningful threshold rather than a strict any-value check, you'll want to pre-process the mask (clamp near-zero values to true zero) before this node sees it.
It only looks at the mask you give it. If your image's alpha channel hasn't actually been extracted into a MASK yet, this node has nothing to check - make sure whatever's loading your image is actually separating out alpha before this node runs, or you'll get a 2 regardless of what the source file really contains.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| mask | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | — |