Nodes/Transparency Background Remover/Transparency Background Remover
ComfyUI Node

Transparency Background Remover

The no-model background remover that actually likes pixel art

By Limbicnation·Created about a year ago·Updated 4 months ago· 22
Transparency Background Remover
  • image
  • image
  • mask
tolerance30
edge_sensitivity0.80
foreground_bias0.70
color_clusters8
binary_threshold128
output_sizeORIGINAL
scaling_methodNEAREST
edge_refinementtrue
dither_handlingtrue
output_formatRGBA
auto_adjustfalse
edge_detection_modeAUTO

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 sprite
  • tolerance (0-255) - how close a pixel must be to the background color to count; lower keeps more
  • edge_sensitivity and foreground_bias - how much detail to preserve, and how hard to protect the subject
  • color_clusters (2-20) - bump up for noisy or complex backgrounds
  • binary_threshold (0-255) - how aggressively soft pixels get forced opaque
  • output_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: sklearn on 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 tolerance around 10-20 and scaling_method on 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.

Categoryimage/processing

Inputs (13)

NameTypeDefaultDescription
imageIMAGE
toleranceINT300–255Color similarity threshold for background detection (0-255)
edge_sensitivityFLOAT0.800–1Edge detection sensitivity (0-1)
foreground_biasFLOAT0.700–1Bias towards foreground preservation (0-1)
color_clustersINT82–20Number of color clusters for background detection
binary_thresholdINT1280–255Threshold for binary alpha mask (0-255)
output_sizeCOMBOORIGINALTarget output size (power-of-8 dimensions for optimal scaling)
scaling_methodCOMBONEARESTInterpolation method: NEAREST (pixel-perfect), BILINEAR (smooth), BICUBIC (high-quality), LANCZOS (best quality)
edge_refinementoptBOOLEANtrueApply edge refinement post-processing
dither_handlingoptBOOLEANtrueEnable dithered pattern detection and handling
output_formatoptCOMBORGBAOutput format: RGBA with alpha channel or RGB with separate mask
auto_adjustoptBOOLEANfalseAutomatically adjust parameters based on image content analysis
edge_detection_modeoptCOMBOAUTOEdge detection optimization: AUTO (detect content type), PIXEL_ART (sharp edges), PHOTOGRAPHIC (smooth edges)

Outputs (2)

NameTypeDescription
imageIMAGE
maskMASK