Image Alpha Clean
Sweep the speckles and fringe out of your alpha channel
- image
- image
- noise_mask
Cutout work leaves a mess behind. After a background-removal pass or an alpha split, you'll get the same artifacts every time: stray opaque specks floating in the transparent area, half-transparent fringe around the edges, and RGB noise where the alpha says "nothing here." Image Alpha Clean is the tidy-up node for exactly that - it scrubs the alpha channel and returns a cleaner RGBA image.
How it works
It operates per-frame on the alpha channel. For each frame it: removes small isolated components (the specks) below a size threshold, drops fringe and edge bleed at a tunable strength, and - the important part - zeroes the RGB where the alpha is fully transparent, so you don't have invisible color junk hiding under your transparency. It's the same family of cleanup logic as the pack's Mask Alpha Clean, but operating on the image's own alpha instead of a separate mask.
The inputs:
- image - the RGBA image to clean.
- clean_strength -
soft,balanced(default), orstrong. Soft barely touches anything, strong aggressively kills islands and fringe. Start balanced; go strong only when the source alpha is genuinely noisy. - detect_only -
false(default) returns the cleaned image.trueskips the actual cleaning and returns the noise mask instead - the map of everything it would remove. That's a great debugging view before you commit to a strength.
Outputs: image (cleaned RGBA) and noise_mask (MASK). Both always come out - with detect_only on, the image output is just the unchanged input.
Why you'd reach for it
Any pipeline that produces transparency: Detect Remove BG and similar cutout nodes, Image Alpha Split flattening work, transparent PNGs from image editors that developed artifacts in transit. If you're feeding cutouts into an overlay or a compositing stack, a dirty alpha is the difference between a clean composite and faint halos you can't pin down. Run the images through this first and the halos stop being mysterious.
Installing it
ComfyUI Manager, search "ComfyUI 1hewNodes", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes
The pack's install is heavy (opencv, rembg, ultralytics...) but this node only needs numpy and torch - the fat requirements exist for the pack's detection nodes.
Gotchas
detect_only is easy to forget you left on, and the symptom is "the node does nothing." If your cleaned output looks identical to the input, check that switch first. Also, aggressive cleaning can eat legitimately thin details - hair strands, light filaments, anything with fine alpha structure is the first casualty of strong. And this cleans alpha noise, not RGB; if your problem is color fringe on the edges of a solid cutout, you want a matte/defringe pass instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| clean_strength | COMBO | balanced | 3 options: soft, balanced, strong |
| detect_only | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| noise_mask | MASK | — |