Detect Edges (Canny)
The edge map that started ControlNet
- image
- IMAGE
Canny is the edge detector that built the ControlNet era. Feed it any image and it hands back thin white lines on black - the classic "edge map" that you then feed into a Canny ControlNet to force your generated image to follow those exact contours. It's been in ComfyUI core since July 2023, and despite being the most famous preprocessor in the ecosystem, it's also the most misunderstood, because beginners keep expecting it to do something on its own. It doesn't. It just draws lines.
What it actually is
Canny is a 1986 edge-detection algorithm: blur the image, compute gradients, thin the response to single-pixel lines (non-maximum suppression), then keep only edges that survive a two-threshold test - a hysteresis pass where strong edges are kept and weak edges are kept only if they connect to strong ones. That last part is exactly what your two sliders control:
- low_threshold (0.01–0.99, default 0.4) - below this, it's not an edge. Lower it and you get more edges (more sensitivity, more noise).
- high_threshold (0.01–0.99, default 0.8) - above this, definitely an edge. Edges in between survive only if they touch a strong edge.
Defaults of 0.4/0.8 are a genuinely good starting point. Too noisy a map → raise low_threshold. Map too sparse → lower it. If low and high sit close together, you get fragmented little dashes instead of connected lines.
The output is a single-channel edge map repeated to RGB: white lines on black. For generation, that's the shape a Canny ControlNet is trained to read.
Where it fits
This is a preprocessor, not a ControlNet. In a workflow it goes: Load Image → Canny → (edge map) → ControlNet Loader → Apply ControlNet → Sampler. The edge map alone changes nothing about your generation - it only matters once a ControlNet model consumes it. The KB's ControlNet essay is the right place to get the full picture, but the short version: Canny excels at architectural scenes, mechanical objects, and anything with clean, hard contours. For organic subjects, lineart or softedge (HED) usually behaves better, and those live in the ControlNet Auxiliary Preprocessors pack, not core.
One more context point worth knowing: the menu of Canny ControlNets shrank for the 2025–26 architectures. Every modern base gets a canny condition in its union model, but the SD-era exotic conditions never got rebuilt. So the built-in Canny node is timeless, and which ControlNet you can feed it to is the variable.
Getting it
Ships with ComfyUI core - search "Canny" (or "Detect Edges"). It's been there since mid-2023, so any recent install has it.
Common gotchas
- It's not the ControlNet. The #1 beginner error is wiring the edge map straight into the sampler and wondering why nothing changed. The map is an input to a ControlNet, full stop.
- White-on-black matters. Some ControlNets expect it; the built-in node always outputs white lines on black, which is what the standard canny models want. If you're using a custom model that expects the inverse, invert before feeding.
- fp16 broke it once. A March 2026 fix (
#13085) addressed Canny failing with fp16 intermediates - if you run fp16 and get garbage, that's a ComfyUI update, not your thresholds. - Thresholds are global. They apply across the whole image, so a scene with both faint and bold lines is a compromise; the defaults exist precisely because most images are a compromise.
When it works - and for architecture it works beautifully - the edge map is the difference between "generated something" and "generated this exact composition."
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| low_threshold | FLOAT | 0.400.01–0.99 | — |
| high_threshold | FLOAT | 0.800.01–0.99 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |