BrightnessTransparency
Turn bright pixels into see-through ones
- images
- IMAGE
BrightnessTransparency does exactly what the name threatens: it reads each pixel's brightness and converts it into transparency, so bright areas become see-through and dark areas stay opaque. It's a luminance keyer - the digital equivalent of shooting a subject against a white backdrop and making the white vanish in post. For a narrow class of inputs, it's genuinely useful; for everything else, it's a trap, and knowing which is which is the whole game.
The mental model is simple. The node converts your image to grayscale, then sets each pixel's alpha to 1.0 - grayscale. A white pixel (1.0) gets alpha 0 - fully transparent. A black pixel (0.0) gets alpha 1 - fully opaque. Everything in between becomes a smooth ramp of partial transparency, which is both the feature and the danger. The soft ramp means no hard cut edges - great for things like smoke, glow, or textures with soft boundaries. But it also means everything bright goes transparent, not just the background. A white shirt, a bright highlight on a cheek, the specular on a car - all of it will start disappearing. This is a crude key, and it keys on nothing but brightness.
How it works
Input handling is thoughtful: if you feed it a 3-channel RGB image, it first promotes it to RGBA with alpha set to 1.0, then computes the per-pixel alpha from luminance. If you feed it an already-transparent image, it keeps your existing RGB and just overwrites the alpha channel with the brightness-derived value. The grayscale conversion uses OpenCV's luminance weighting (0.299R + 0.587G + 0.114B), so green contributes more than blue - a sensible "perceived brightness" mapping.
images(IMAGE) - the image or batch to key. Only input.- Output: an IMAGE tensor with a 4th alpha channel, where
alpha = 1 - luminance.
It's also the half of a pair: the pack's AlphaToGrayscale computes gray = 1 - alpha, which is precisely the inverse, so you can round-trip brightness → transparency → grayscale.
Where it's actually good
The sweet spot is white- or light-background source material where you want the background gone and the subject is meaningfully darker: line art, sprites, product images on white, icons, hand-drawn scans. For that family of inputs, a brightness key is a legitimate, classic technique and this is a clean implementation. The round-trip with AlphaToGrayscale also makes it a sneaky way to store luminance in the alpha channel for later - the "brightness as data" trick.
The trap
For real background removal - photos, hair, fur, anything with detail - this is the wrong tool, and it will quietly eat your subject's bright parts. The ecosystem's default answer there is a dedicated segmentation model (BiRefNet is the standard pick and ships in core ComfyUI), which understands what is background rather than just how bright it is. Use BrightnessTransparency for flat, clean source; use a model for photographs. Also note there are no controls - no threshold, no edge blur, no spill suppression - so what you see is what you get.
Installing
Standard for the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/keit0728/ComfyUI-Image-Toolkit
Restart, or install "ComfyUI-Image-Toolkit" from ComfyUI Manager. Sole dependency: opencv-python==4.11.0.86 (pinned). No models, no downloads, CPU-only.
Gotchas
Besides the brightness-keys-everything-bright gotcha, remember this pack is a tiny anonymous project - Japanese author, last touched mid-2025, README clone URL is a placeholder (your-username) with the real repo at keit0728/ComfyUI-Image-Toolkit. It works, it's simple, and nobody's going to answer questions about it. For this node, understanding the algorithm is the troubleshooting guide.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Input images to adjust transparency. Bright areas will become transparent. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |