ComfyUI Node Runs on cloud

Image Threshold

Turn an image into hard black-and-white for masks and stencils

By WASasquatch·Created 3 years ago·Updated about a year ago· 1,812
Image Threshold

      Image Threshold takes an image and returns it as hard black and white - no grays, no gradients, just "above the cutoff" and "below it." It's one of the oldest tricks in image processing, and it earns its keep in a ComfyUI graph as a fast way to turn a photo into a stencil, a rough mask, or a starting point for line-art-style processing.

      How it works

      Thresholding converts the image to a single brightness value per pixel and then compares it against a cutoff: pixels brighter than the threshold flip to white, everything else flips to black. Push the threshold low and almost everything turns white; push it high and almost everything turns black. Somewhere in the middle, depending on the image's actual tonal range, you get a clean silhouette-style split that follows the real contrast boundaries in the source.

      Why you'd reach for it

      A few honest uses: quick, rough masking when you need a binary cutout and don't want to run a full segmentation model for it; converting a photo into a poster-style, high-contrast graphic look; or prepping an image as a base for further edge or line-art processing further down the graph. It's not a substitute for anything model-based - it has no understanding of what's in the image, only how bright each pixel is - so it works best on images with genuinely strong tonal separation between what you want isolated and everything else. A backlit subject against a bright sky thresholds beautifully. A face against a similarly-lit background does not.

      Worth noting this operates on the image directly, not a mask. The suite has a parallel family of mask-specific threshold and region tools (Mask Threshold Region, Mask Ceiling Region, Mask Floor Region) if what you're actually manipulating is already a MASK rather than a full image.

      Installing it

      Through ComfyUI Manager: search "WAS Node Suite", install, restart. Manually:

      cd ComfyUI/custom_nodes
      git clone https://github.com/WASasquatch/was-node-suite-comfyui
      cd was-node-suite-comfyui
      pip install -r requirements.txt
      

      No model downloads for this one - it's pure pixel math.

      Troubleshooting

      If the result comes out entirely white or entirely black, that's almost always the threshold setting being outside the image's actual brightness range rather than a bug - nudge it toward the middle and you'll usually find the point where the split actually reflects your subject.

      As with everything in this pack: WAS Node Suite has had no active development since the author stepped back in December 2023. If Image Threshold - or any WAS node - vanishes from your menu after a ComfyUI update, that's typically the whole suite failing to import over a stale pinned dependency, not this specific filter breaking. Check the startup console log before troubleshooting the node itself.

      Categoryx

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs