Nodes/ComfyUI-AdvancedAlphaProcessor/Advanced Alpha Processor with Black Removal
ComfyUI Node

Advanced Alpha Processor with Black Removal

White to Transparent Without the AI — the Luma-Key Node That Just Works

By 852wa·Created 2 years ago·Updated 2 years ago· 10
Advanced Alpha Processor with Black Removal
  • image
  • Output
  • Black_Removed
invert_alphaenable
midrange_cutdisable
cut_threshold0.50
gamma_correction2.2
remove_black_threshold0.15
force_grayscaleenable

You do not need a segmentation model for everything. If your image sits on a clean white (or black) background - a logo, a screenshot, generated art on a flat ground - reaching for BiRefNet is like calling in an excavator to move a potted plant. This node is the trowel: a tiny, dependency-free luma key that turns brightness into an alpha channel in pure numpy. No model download, no VRAM, no API, no key. The "Advanced" in the name is doing heavy lifting, but the idea is as old as Photoshop's "white to transparent" trick.

It comes from a Japanese indie dev (852wa), ships one node, and the README is in Japanese. There's basically no community noise around it yet, so this article is me reading the source so you don't have to.

How it works

Feed it an image and it runs a five-step pipeline per frame: gamma-correct the RGB, flatten to grayscale (Rec. 709 luma weights), build an alpha channel from the original pixels' luma, then - because invert_alpha defaults to enable - flip it so bright pixels become transparent and dark pixels become opaque. Finally it premultiplies the RGB by alpha and applies the inverse gamma so your colors don't go mushy. Two outputs come out:

  • Output - the straight inverted-alpha key.
  • Black_Removed - the same thing, plus any pixel where all three channels are below remove_black_threshold has its alpha forced to zero. That's the knob aimed at black-background art; the README says to run it with midrange_cut off.

The inputs that matter

Only image is required; everything else has a sensible default. The ones a beginner actually touches:

  • invert_alpha - leave it on unless you want black to become transparent instead of white.
  • remove_black_threshold (0.15) - how aggressive the black cut on the second output is. Raise it to eat more shadow, lower it to keep dark detail.
  • gamma_correction (2.2) - bump it up to push brights brighter and darks darker before the key; lower it to compress midtones.

The rest you can ignore for a while. midrange_cut + cut_threshold turn the soft alpha into a hard binary on/off mask if you want a brutal, clean edge. force_grayscale defaults to enable because the author says it's more accurate that way.

Where it fits

This is the cheap deterministic end of the background-removal spectrum. The KB's take: BiRefNet (in ComfyUI core since May 2026) is your default for hair, fur, and messy backgrounds; LayerDiffusion bakes alpha in at generation time. This node is for the flat, single-color cases where a semantic model is overkill - and where you want identical, repeatable results on a whole batch. One honest warning: luma keying leaves a grey fringe on soft or textured edges. Don't reach for it on hair, and don't use it to "clean up" a LoRA training set - removing backgrounds from training data is a known footgun.

Install

ComfyUI Manager → search ComfyUI-AdvancedAlphaProcessor, or the manual way:

cd ComfyUI/custom_nodes
git clone https://github.com/852wa/ComfyUI-AAP

Then restart ComfyUI. There are no model downloads and no heavy dependencies - requirements.txt is just numpy and torch, both of which ComfyUI already ships. This is about as clean an install as the ecosystem offers.

Gotchas

The big one: this node outputs RGBA tensors, but not every node in a graph preserves alpha - some silently drop the channel. Save through SaveImage (PNG keeps alpha; JPEG destroys it) and preview with PreviewImage. If your "transparent" output comes back as a black block, you've hit a node that ate the alpha, not a node bug. For batch work, the README points you at feeding in Load Images (multiple) - the node already loops over the whole batch internally. And if dark speckles survive in the first output, just grab the second.

CategoryImage Processing

Inputs (7)

NameTypeDefaultDescription
imageIMAGE
invert_alphaCOMBOenable2 options: enable, disable
midrange_cutCOMBOdisable2 options: disable, enable
cut_thresholdFLOAT0.500–1
gamma_correctionFLOAT2.21–3
remove_black_thresholdFLOAT0.150–1
force_grayscaleCOMBOenable2 options: enable, disable

Outputs (2)

NameTypeDescription
OutputIMAGE
Black_RemovedIMAGE