Remove Background & Resize
Cut out and resize in one node, no OpenCV required
- image
- image
- mask
The pack has a quieter second member, and it's the one you might actually keep in every workflow. Remove Background & Resize combines a background cutout and a resize into a single node, and it's the only node in this pack that runs without OpenCV. Its k-means clustering is hand-rolled in plain numpy on top of Pillow - which means it also doesn't need scikit-learn. Where the flagship quietly loses its color clustering when sklearn is missing, this one just keeps working. Drop it into any ComfyUI and it functions. That's a genuinely nice resilience property.
Reach for it when you know the target size before you run. It's flagged as an output node in the source, so it behaves like a terminal step: "cut the background, deliver at exactly this size." The output_size choices give the intended use away - ORIGINAL, 512x512, 768x768, 1024x1024, 1280x720, 1920x1080. Those 16:9 options say product shots and page banners more than sprite sheets, and the default scaling_method is LANCZOS, the right call for photos.
The inputs that matter
tolerance(0-255) - colour distance threshold; higher is more aggressive extractionforeground_bias- bias toward keeping pixels as foregroundcolor_clusters- k-means centre count for the colour segmentationoutput_sizeandscaling_method(NEAREST for pixel-perfect, LANCZOS for photos)dither_handling- edge erosion to suppress dither artefacts (note: different meaning than the flagship's dither detection)binary_threshold- alpha mask binarisation cutoff
Two outputs: image and mask, same as the rest of the pack.
Where it fits
It's the same technique family as the flagship - a solid subject on a contrasting background - so the same limits apply: don't feed it a head of curly hair and expect magic. What it trades away is the flagship's content-aware switching: there's no edge_detection_mode, no auto_adjust, no pixel-art/photo pipeline choice, and no RGBA-vs-separate-mask option; you get a cutout and its mask at the size you asked for. If your subject's edges are the whole point, use the flagship and resize separately. If you just need clean, correctly-sized cutouts fast, this is the one you'll actually reach for.
Install
Same pack, same story - ComfyUI Manager, search "Transparency Background Remover", or:
cd ComfyUI/custom_nodes
git clone https://github.com/Limbicnation/ComfyUI-TransparencyBackgroundRemover.git
cd ComfyUI-TransparencyBackgroundRemover
pip install -r requirements.txt
Restart ComfyUI. The one thing to know: this node's dependencies are so light that even in a broken install (no sklearn, no OpenCV) it still runs, which makes it a decent canary - if this node loads, your install is fine and any other failure is in the heavier nodes.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image tensor from upstream node | |
| tolerance | INT | 300–255 | Colour distance threshold. Higher = more aggressive foreground extraction (0-255). |
| foreground_bias | FLOAT | 0.700–1 | Bias toward keeping pixels as foreground. Higher = more pixels preserved. |
| color_clusters | INT | 82–20 | Number of k-means centres for colour segmentation. |
| output_size | COMBO | ORIGINAL | Resize output to this size. ORIGINAL keeps source dimensions. |
| scaling_method | COMBO | LANCZOS | Interpolation method. LANCZOS = best quality; NEAREST = pixel-perfect for pixel art. |
| dither_handlingopt | BOOLEAN | true | Apply edge erosion to suppress dither artefacts. |
| binary_thresholdopt | INT | 1280–255 | Alpha mask binarisation cutoff (0-255). |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |