Nodes/ComfyUI-Inference-Core-Nodes/[Inference.Core] Canny Edge
ComfyUI Node

[Inference.Core] Canny Edge

The Classic Edge Detector, Still the Default

By LykosAI·Created 2 years ago·Updated about a year ago· 33
[Inference.Core] Canny Edge
  • image
  • IMAGE
low_threshold100
high_threshold200
resolution512

Canny is the one everyone tries first, and there's a reason for that: it's the oldest edge detector in the box (decades older than diffusion models, if you go back to the original 1986 algorithm) and it still produces the cleanest, thinnest edge maps of any of the preprocessors here. If your source image has hard contours - buildings, mechanical parts, product shots, anything with clear geometric lines - Canny gives the ControlNet exactly what it needs and nothing it doesn't.

There's no neural network involved, which is refreshing in a pack full of things that need weights downloaded. It's classic computer vision: a hysteresis threshold pass that keeps strong edges, drops weak ones, and links up edge segments that fall in between. That's what the two threshold inputs actually control. low_threshold and high_threshold (defaults 100 and 200, both 0–255) set the boundaries of that hysteresis - pixels above the high threshold are always kept as edges, pixels below the low threshold are always dropped, and anything in between only survives if it connects to a strong edge. Push both thresholds up and you get a sparser, cleaner map that keeps only the dominant contours; pull them down and you catch more faint detail, at the cost of noisier edges that can pick up texture you didn't want conditioned on.

What you set: image is the only required input. low_threshold, high_threshold, and resolution (default 512) are all optional with reasonable defaults - most people never touch them until an image is either too noisy or too sparse. The single IMAGE output goes straight into a ControlNet Apply node, paired with a Canny ControlNet checkpoint loaded separately - this preprocessor produces the condition image, it doesn't load or apply the model itself.

Canny's had unusually good staying power across base model generations, which isn't true of most of the other preprocessors in this pack. It's one of the conditions that survived every architecture transition - SDXL's xinsir union, Flux's Union Pro, Qwen-Image's InstantX union, and the current Z-Image and Flux 2 unions all ship canny support, while things like segmentation and reference conditioning got left behind on SD 1.5 and SDXL. If you only remember one preprocessor from this pack, it's a safe bet it's this one, because it's the one guaranteed to still be relevant on whatever base you're using next year.

Installing it: this ships in LykosAI's ComfyUI-Inference-Core-Nodes - LykosAI also makes Stability Matrix, the meta-installer a lot of people use to manage multiple local SD UIs, so this pack's install path is more deliberate than most. Search "ComfyUI-Inference-Core-Nodes" in ComfyUI Manager and install from there, or go manual: cd ComfyUI/custom_nodes && git clone https://github.com/LykosAI/ComfyUI-Inference-Core-Nodes, then pip install -e .[cuda] / .[cuda12] / .[rocm] / .[directml] / .[cpu] for the matching accelerated onnxruntime build, or plain pip install -e . if you don't need the acceleration extras (Canny doesn't, since it's pure OpenCV - but other nodes in this same pack do). Restart ComfyUI once it's done.

Troubleshooting: Canny is one of the more bulletproof nodes here precisely because it's not running a model, so problems tend to be install-level, not runtime. If the whole pack refuses to load, the classic symptom is ModuleNotFoundError: No module named 'inference_core_nodes' - the git clone succeeded but the Python package step didn't, often because install.py ran against a different Python than ComfyUI actually uses (double-check this on a portable/embedded install). If your edge map looks either completely blank or solid noise, that's almost always the thresholds, not a bug - try the defaults first, then nudge both up together if it's too busy, or both down if it's missing structure you expected to see.

CategoryControlNet Preprocessors/Line Extractors

Inputs (4)

NameTypeDefaultDescription
imageIMAGE
low_thresholdoptINT1000–255
high_thresholdoptINT2000–255
resolutionoptINT51264–2048

Outputs (1)

NameTypeDescription
IMAGEIMAGE