Transparency Background Remover
The no-model background remover that actually likes pixel art
- image
- image
- mask
Most background-removal nodes you'll run into are a neural network in a trench coat: load the weights, wait for the checkpoint to download, hope the GPU cooperates. This one is the odd one out. It's pure classical computer vision - edge detection, color clustering, corner sampling - which means no model files, no downloads, no VRAM, and it runs happily on CPU. The author (Limbicnation) built it with a specific pain in mind: game sprites and pixel art, where neural cutout models love to blur or nibble away crisp 1-pixel outlines.
Reach for it when your subject is solid and your background is flat or high-contrast. Product shots on a clean backdrop, sprites, icons, UI elements, stickers - all stuff this handles instantly and for free. It outputs real transparency, and it's fast enough to feel like a filter. Just don't expect it to win the hard cases. Flyaway hair, fur, fabric mesh, glass, smoke - that's where the knowledge-base advice still applies: bring a neural model like BiRefNet instead. This node is a complement to those, not a replacement.
How it works
The engine fuses several signals into one alpha mask. First it looks at the image and decides whether it's pixel art or a photo - you can force that call with edge_detection_mode (AUTO, PIXEL_ART, PHOTOGRAPHIC). Then it runs edge detection three ways at once - Roberts Cross, Sobel and Canny - each strong at different things, and averages out their mistakes. In parallel, K-means color clustering finds the dominant background colors and flags matching pixels; corner sampling seeds the background guess from the image borders when clustering comes up empty. The README's claim that it's "content-aware" is genuinely earned: the pixel-art path uses sharper operators and the photo path favors smoother ones.
The inputs you'll actually touch:
edge_detection_mode- set PIXEL_ART manually if AUTO misjudges a spritetolerance(0-255) - how close a pixel must be to the background color to count; lower keeps moreedge_sensitivityandforeground_bias- how much detail to preserve, and how hard to protect the subjectcolor_clusters(2-20) - bump up for noisy or complex backgroundsbinary_threshold(0-255) - how aggressively soft pixels get forced opaqueoutput_size- ORIGINAL or a power-of-8 preset (256, 512, 1024...)output_format- RGBA (alpha embedded) or RGB_WITH_MASK
Two outputs: image and mask. Wire image into a Preview or Save node; feed mask into compositing or inpainting. With output_format set to RGB_WITH_MASK you get an opaque RGB image plus the mask as a separate stream, which is the safe pick when downstream nodes silently drop alpha channels.
Install
ComfyUI Manager is the easy route - search "Transparency Background Remover" and install - or clone it:
cd ComfyUI/custom_nodes
git clone https://github.com/Limbicnation/ComfyUI-TransparencyBackgroundRemover.git
cd ComfyUI-TransparencyBackgroundRemover
pip install -r requirements.txt
Restart ComfyUI and it shows up under image/processing. The dependency list is heavier than the node feels: OpenCV, scikit-learn, numpy, Pillow, plus structlog and pydantic. On the portable/embedded ComfyUI build, use the included install.bat (Windows) or ./install.sh (Linux/Mac) so the packages land in the right Python.
Common issues
ModuleNotFoundError: sklearnon startup. The node still runs, but color clustering is disabled and accuracy drops to roughly 85-90% on complex backgrounds. Run the install script, restart.- Images under 64x64 are rejected. Upscale first.
- Bad masks on a sprite. Force PIXEL_ART mode, keep
tolerancearound 10-20 andscaling_methodon NEAREST. - Hair and glass look rough. That's the technique's known limit, not a settings bug - switch to a neural remover for those.
Need a whole folder cut? The pack ships a dedicated batch variant that auto-tunes each image - reach for that instead of looping this node.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| tolerance | INT | 300–255 | Color similarity threshold for background detection (0-255) |
| edge_sensitivity | FLOAT | 0.800–1 | Edge detection sensitivity (0-1) |
| foreground_bias | FLOAT | 0.700–1 | Bias towards foreground preservation (0-1) |
| color_clusters | INT | 82–20 | Number of color clusters for background detection |
| binary_threshold | INT | 1280–255 | Threshold for binary alpha mask (0-255) |
| output_size | COMBO | ORIGINAL | Target output size (power-of-8 dimensions for optimal scaling) |
| scaling_method | COMBO | NEAREST | Interpolation method: NEAREST (pixel-perfect), BILINEAR (smooth), BICUBIC (high-quality), LANCZOS (best quality) |
| edge_refinementopt | BOOLEAN | true | Apply edge refinement post-processing |
| dither_handlingopt | BOOLEAN | true | Enable dithered pattern detection and handling |
| output_formatopt | COMBO | RGBA | Output format: RGBA with alpha channel or RGB with separate mask |
| auto_adjustopt | BOOLEAN | false | Automatically adjust parameters based on image content analysis |
| edge_detection_modeopt | COMBO | AUTO | Edge detection optimization: AUTO (detect content type), PIXEL_ART (sharp edges), PHOTOGRAPHIC (smooth edges) |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |