Nodes/ComfyUI-Inference-Core-Nodes/[Inference.Core] Binary Lines
ComfyUI Node

[Inference.Core] Binary Lines

The Bluntest Line Extractor in the Pack, On Purpose

By LykosAI·Created 2 years ago·Updated about a year ago· 33
[Inference.Core] Binary Lines
  • image
  • IMAGE
bin_threshold100
resolution512

Don't mistake this for an edge detector - it isn't one. Canny and Lineart actually look for contours and contrast changes; this one just draws a line in the sand at a fixed brightness value and calls everything above it white, everything below it black. No contour detection, no gradient analysis, just a hard threshold on luminance. That makes it the crudest tool in this pack's line-extractor family, and also the fastest and most predictable.

That bluntness is a feature in a narrow set of cases and a liability everywhere else. Feed it a photograph and you'll usually get a mess - real photos have too much smooth gradation for a single brightness cutoff to produce anything resembling useful line art. Feed it something that's already close to black-and-white - a scanned ink drawing, a rough silhouette, a high-contrast logo - and it does exactly what you want with zero fuss: forces it to clean, pure binary without the softening a Gaussian-based approach like Lineart Standard would introduce.

What you set: image is required, and there's exactly one thing worth tuning - bin_threshold (default 100, range 0–255). This is the brightness cutoff itself. Raise it and more of the image falls below the line and turns black, which thins out what survives as "white" line/region; lower it and more of the image turns white. There's no clever hysteresis or edge-linking logic like Canny has - it's a single, literal per-pixel comparison. resolution (default 512) is the standard preprocessing size shared across this pack. The single IMAGE output goes to a ControlNet Apply node, typically paired with a Lineart or Scribble-family ControlNet checkpoint depending on what your source material actually needed.

The honest guidance: if you're not sure whether Binary is the right call, it probably isn't. Canny handles photos with actual geometric structure better, and Lineart Standard handles organic/painterly photos better, because both look at local contrast rather than a single global brightness value. Binary earns its place specifically when your source is already most of the way to black-and-white and you just need to snap it into a hard-edged version - a job the more sophisticated preprocessors will sometimes over-process.

Installing it: this ships in LykosAI's ComfyUI-Inference-Core-Nodes pack - LykosAI also builds Stability Matrix, the meta-installer a lot of people use to manage local SD UIs, so this pack's install tends to be more deliberate than a typical solo repo. Search "ComfyUI-Inference-Core-Nodes" in ComfyUI Manager, or manually: cd ComfyUI/custom_nodes && git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes, then run install.py against ComfyUI's Python environment, or pip install -e .[cuda] / .[cuda12] / .[rocm] / .[directml] / .[cpu] matched to your hardware, or a plain pip install -e . without acceleration (this node doesn't need it - it's pure thresholding). Restart ComfyUI when done.

Troubleshooting: this is about as simple as image processing gets, so runtime issues are almost always the threshold value, not a bug - if the output is nearly all black or nearly all white, bin_threshold is set too far from your source image's actual brightness range, and nudging it toward the middle of your image's histogram usually fixes it immediately. The genuine pack-level issue to watch for is ModuleNotFoundError: No module named 'inference_core_nodes' after a git clone, meaning the Python install step didn't finish - commonly from install.py running against the wrong interpreter on a portable ComfyUI build, where you need to target python_embeded explicitly rather than your system Python.

CategoryControlNet Preprocessors/Line Extractors

Inputs (3)

NameTypeDefaultDescription
imageIMAGE
bin_thresholdoptINT1000–255
resolutionoptINT51264–2048

Outputs (1)

NameTypeDescription
IMAGEIMAGE