Threshold image with value
Threshold Image (ThresholdNode) — ComfyUI-LogicUtils
- image
- IMAGE
Threshold takes a soft, grayscale-ish image and snaps it into hard black and white. Every pixel brighter than a cutoff becomes white; everything darker becomes black. There's no gray in the result, just the two extremes. If you've ever wanted to turn a fuzzy depth map, a soft mask, or a preview into a crisp stencil, this is the operation you're after.
Where it actually earns its keep is mask and control-image prep. A depth estimator or a soft segmentation gives you smooth gradients, which is great for some things and terrible when you want a clean cutout or a hard edge to drive an inpaint. Push it through Threshold and you get a decisive black-white boundary you can composite against, use as a stencil, or feed somewhere that wants a binary mask instead of a gradient. It's a blunt instrument, and blunt is sometimes exactly right.
Threshold ships in ComfyUI-LogicUtils, the utility pack from aria1th, the handle behind AngelBottomless who trained Illustrious XL. It's a personal toolkit with thin documentation, so the node is minimal and you calibrate it by eye rather than by reading a spec.
Inputs and outputs
Two required inputs. image is the IMAGE you're binarizing. threshold is an INT with a default of 128, and that's the cutoff value on the standard 0-to-255 brightness scale, so 128 is the midpoint. Pixels above the cutoff go one way, below go the other. The single output is an IMAGE, now hard black and white.
The threshold is the only real knob, and it's the one you'll tune. There's nothing else to set.
Installing it
- ComfyUI Manager: Custom Nodes Manager, search "ComfyUI-LogicUtils," install, restart.
- Manual:
cd ComfyUI/custom_nodes && git clone https://github.com/aria1th/ComfyUI-LogicUtils, then restart.
No models, no heavy dependencies. The pack's optional dependency installer only runs if you set COMFYUI_LOGICUTILS_AUTO_INSTALL=1 (turn it off with COMFYUI_LOGICUTILS_SKIP_INSTALL=1), and thresholding an image needs nothing extra.
Dialing it in
The whole game is picking the threshold value, and the two failure modes are symmetric. Set it too high and almost nothing clears the bar, so you get a near-black image. Set it too low and almost everything passes, so you get a near-white one. If your result is all one color, that's the cause, and the fix is to nudge the number toward the middle and watch what the image does.
Because the scale is 0-255, remember your threshold lives in that range, not 0-1. 128 is a sensible starting point, and from there you move it based on how bright the input actually is. A dark input wants a lower cutoff; a bright one wants a higher one. It's fiddly in the way any thresholding operation is fiddly, but there's only one number to chase, so it doesn't take long to find the sweet spot.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| threshold | INT | 128 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |