Light-Tool: Is Transparent
A yes/no for 'does this image have alpha?' — if it arrived with alpha at all
- image
- BOOLEAN
Light-Tool: IsTransparent answers one question - "does this image have transparent pixels?" - and hands you a BOOLEAN you can route into a switch, a conditional, or a branch in your graph. It's the kind of node you don't think you need until you're batch-processing a folder where half the PNGs have alpha and half are flattened, and you want one workflow to handle both without exploding.
Inputs: image and threshold, a float slider from 0.01 to 0.99 (default 0.01). Output: one BOOLEAN.
How it decides. For RGBA images it computes the fraction of pixels whose alpha is below 1 and compares that ratio to the threshold. Default threshold of 0.01 means "more than 1% of pixels are not fully opaque" counts as transparent - which catches most real cutouts while ignoring a single stray antialiased pixel. The threshold slider is there for the cases where the default is wrong: raise it if you only care about large transparent areas, and it will tolerate a few fringe pixels.
For palette-mode images (some PNGs) it looks up the transparency index. For anything else - a plain RGB image - it returns False. No error, just a confident no.
The trap, and it's a big one. ComfyUI's default loaders convert everything to RGB and discard the alpha channel before the image ever reaches a downstream node. Feed this node an RGB tensor from a standard load and it will always say False, even if the source PNG had huge transparent regions, because the evidence was destroyed upstream. To get a meaningful answer you have to load with the alpha kept: this pack's LoadImage or LoadImageFromURL with keep_alpha_channel on, or any loader that preserves RGBA. If every image reads as opaque, check your loader, not the node.
When it's actually worth it. In batch pipelines. Imagine a folder of cutouts where some are RGBA PNGs and some got flattened to RGB along the way - a branch that feeds transparent images to a background-flattening node and opaque ones straight through is exactly this node's job. Pair it with a switch node (or this pack's own conditionals) and you've automated away a manual sort.
Installing. Standard for this pack:
cd ComfyUI/custom_nodes
git clone https://github.com/ihmily/ComfyUI-Light-Tool.git
pip install -r requirements.txt
# restart ComfyUI
Or ComfyUI Manager → search ComfyUI-Light-Tool → Install. No models, no weights.
Honest note: it's a narrow utility and it's niche even among the pack's nodes - but when a batch of mixed-alpha images is your problem, there isn't a stock core node that answers this question, so it fills a real hole.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | FLOAT | 0.010.01–0.99 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| BOOLEAN | BOOLEAN | — |