THRESHOLD (JOV) π
Clip any input to clean 0-or-1 masks
- πΎ
- πΌοΈ
- π·
The pack's own description nails this node in six words: "Clip an input to explicit 0 or 1." THRESHOLD takes any image or mask and turns it into a hard binary version - every pixel ends up fully on or fully off. If you've ever had a soft gray mask that needed to be a crisp selection, or a color image where you wanted to isolate the bright parts, this is the node.
It's built on OpenCV's threshold functions, exposed in a friendly wrapper. πΎ is the input (image or mask). 𧬠Adapt picks between ADAPT_NONE (one global cutoff) and ADAPT_MEAN or ADAPT_GAUSS (a cutoff computed locally per pixel - the fix for uneven lighting). βοΈ Function is the flavor of threshold: BINARY (the default - above the line goes white, below goes black), TRUNC (caps bright pixels at the threshold instead of flipping them), or TOZERO (zeroes dark pixels, keeps bright ones as-is). π is the threshold value itself (0β1, default 0.5) - the dividing line. π Size is the adaptive block size (3β103) used when you switch to adaptive mode. π³ is an invert toggle (0β1), so a quick flip gives you "everything below the line" instead of above.
Outputs are πΌοΈ IMAGE and π· MASK, both as lists, and you'll almost always want the mask one. The image output is there because sometimes the binary result is easier to preview or needs to go into a color pipeline, but the mask is what plugs into compositing, inpainting, and masking nodes.
The workflow it lives in: take something messy - a soft matte, a noisy grayscale, a channel from PIXEL SPLIT - and THRESHOLD turns it into a decision. Inpainting regions, subject extraction, alpha clean-up, edge maps; any time a downstream node wants a firm yes/no, this is the gate. The two knobs that matter most: π for where the line sits, and 𧬠for whether the line is global or local. Start with ADAPT_NONE and tweak; switch to ADAPT_MEAN when the lighting is uneven and the mask comes out patchy.
A small trap: adaptive thresholding needs a block size that suits your image resolution - too small and it picks up noise, too big and it's basically global again. And TRUNC/TOZERO are not binary at heart; don't expect a hard mask out of them. For the strictly binary result, BINARY is your mode.
This is the current, maintained THRESHOLD node - not one of the pack's legacy ghosts (that would be "π Threshold (jov)", the older build with extra resize controls). It lives in JOVIMETRIX πΊπ©π΅/ADJUST. Install is pack-wide: ComfyUI Manager β search "Jovimetrix", or
cd ComfyUI/custom_nodes
git clone https://github.com/Amorano/Jovimetrix.git
pip install -r Jovimetrix/requirements.txt
then restart. Dependencies are the shared light set - numpy, opencv-contrib-python (where the actual threshold math lives), Pillow, matplotlib, cozy-comfyui helpers - with no model downloads. Keep ComfyUI at 0.1.3+ with a current frontend.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| πΎopt | * | β | |
| π§¬opt | COMBO | ADAPT_NONE | 3 options: ADAPT_NONE, ADAPT_MEAN, ADAPT_GAUSS |
| βοΈopt | COMBO | BINARY | 3 options: BINARY, TRUNC, TOZERO |
| πopt | FLOAT | 0.5000β1 | β |
| πopt | INT | 33β103 | β |
| π³opt | FLOAT | 0.000β1 | β |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| πΌοΈ | IMAGE | β |
| π· | MASK | β |