Nodes/Remade_nodes/Remove Black Pixels to Transparent
ComfyUI Node

Remove Black Pixels to Transparent

Making black backgrounds actually disappear (exactly-black only, no threshold)

By Pheat-AI·Created 2 years ago·Updated 2 years ago· 5
Remove Black Pixels to Transparent
  • image
  • IMAGE

Let's be clear about what this node does, because the name oversells it a little: it turns exactly black pixels - RGB (0, 0, 0) - transparent by setting their alpha channel to zero. Not near-black, not dark gray, not "sort of dark." (1, 1, 1) survives. That precision is both the feature and the trap.

It's one of the small utility nodes in Pheat-AI's Remade_nodes pack, and it exists to solve the oldest problem in compositing: you've got an image with a pure-black background - a logo, a sticker, a render on black - and you want to drop it over something else without the black rectangle showing. Feed it an image, get an RGBA image back where those pixels are now see-through.

What it actually does

The mechanism is a few lines of PIL. The image is converted to RGBA, then every pixel where red, green, and blue are all exactly 0 gets its alpha written to 0. Everything else keeps its alpha. There's no feathering, no threshold slider, no magic. If your background is a gradient down to black or a janky compress-artifact gray, this node will leave most of it alone and you'll wonder why the result still looks like a sticker.

When you'd reach for it

  • You generated a PNG on a black background and want to layer it onto a scene.
  • You're prepping a decal/watermark pass before an overlay or composite node.
  • You want a cheap "key" without pulling in a segmentation model - for pure-black art this is instant and free, and it beats running BiRefNet on something that's already one solid color.

Where people get burned: black is also a legit color inside subjects. Dark hair, black clothing, shadows - those are (0,0,0) too, and this node will happily punch holes straight through them. It has no idea it's removing "background," it's removing "black." For real background removal on photos, that's a job for the segmentation models in our background-removal knowledge base, not a pixel test.

Inputs and outputs

Just two things to know:

  • image (IMAGE) - the input. Feed it one image at a time; unlike the pack's batch nodes, this one has no loop, so a multi-frame batch will fail on the tensor-to-PIL conversion.
  • Output: IMAGE, same size, now with a real alpha channel.

The second gotcha hides here: ComfyUI's IMAGE tensors are float arrays, and most stock Preview/Save nodes flatten to RGB on the way out, which quietly throws the alpha away. So the transparency only looks like it worked if whatever you feed next honors alpha - a compositing node, an RGBA-preserving PNG saver, or another node in this same pack. If you wire this straight into a default SaveImage and see black again, that's not the node failing; the alpha was there and got flattened.

Installing it

The whole pack installs as one unit:

cd ComfyUI/custom_nodes
git clone https://github.com/Pheat-AI/Remade_nodes

Then restart ComfyUI. Easier: ComfyUI Manager → search Remade_nodes → Install. It's listed in the official registry. No models to download, no README in the repo, and the only declared dependency is numpy. One real caveat: the pack's requirements file doesn't list OpenCV, but its color-blend node imports cv2 at load time - if your environment is missing it the whole pack refuses to load. pip install opencv-python in your ComfyUI environment fixes that, and it's already present in most setups.

This is a genuinely thin utility node. It does one pixel test and does it honestly. Just remember: exact black or nothing.

CategoryREMADE/Image

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE