RC Threshold
Binary image in one click
- image
- IMAGE
Sometimes you don't want a photo, you want a silhouette. Threshold takes an image and makes every pixel either black or white based on one value - the oldest trick in image processing, and the direct route to high-contrast line art, stencil looks, and extraction masks. RC_Threshold is the RC Image Compositor pack's version, and it's refreshingly complete for a node this simple: five calculation methods, an invert switch, and alpha preservation so your transparent layers stay transparent.
How it works
It converts the image to a single grayscale value per pixel, compares it against your threshold, and outputs pure black or white. The question is how "gray" is computed, and that's the method dropdown:
- luminance (default) - perceptual luminance,
0.299R + 0.587G + 0.114B. This is the "how bright does it look" calculation, and it's the right default for photos. - average - plain
(R+G+B)/3. Flatter, less perceptually correct, but predictable if you're comparing raw channel sums. - red / green / blue - use a single channel. Want to threshold by how red something is? Pick
redand everything with low red goes black.
The rest:
- threshold (0–1) - pixels below become black, above become white.
- invert - flips it, black becomes white and vice versa. One click for the negative look.
Output is a single IMAGE of pure black/white - and if the input had alpha, the alpha is preserved, so a transparent PNG stays transparent while its content goes binary.
Installing it
ComfyUI Manager → search "RC Image Compositor" → install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kj863257/ComfyUI_RC_Image_Compositor
cd ComfyUI_RC_Image_Compositor
pip install -r requirements.txt
Dependencies: pillow, numpy, opencv-python. Nothing to download.
Where people get burned
- Threshold is global, not local. One value for the whole image. If your image has a bright background and a dark subject, no single threshold separates them cleanly - you'll get noise speckles where the values cross. That's inherent to the operation, not a bug.
- The output is pure black/white, no gray. If you wanted soft edges, this node is binary by design - run a feather (the pack's MaskApply) or a blur on the result if you need antialiased edges.
luminancevsaveragematter more than you'd think. On saturated colors,averageandluminancedisagree visibly - a bright blue flips at different thresholds. If your result looks "wrong" compared to a reference, try the other method.- Don't use it on JPGs with compression artifacts. Blocky noise at the threshold line is a JPEG problem; threshold makes it loud. Clean source in, clean binary out.
Threshold is the node you reach for when you need a mask from a photo, a stencil from a render, or a high-contrast graphic look in two seconds. It's the simplest node in the pack - and sometimes the simplest node is the one that saves the workflow.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | FLOAT | 0.500–1 | Threshold value (0.0-1.0, pixels below this become black, above become white) |
| method | COMBO | luminance | Threshold calculation method: - luminance: Use perceptual luminance (0.299R + 0.587G + 0.114B) - average: Simple RGB average (R + G + B) / 3 - red/green/blue: Use single color channel |
| invert | BOOLEAN | false | Invert the threshold result (black becomes white, white becomes black) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |