CannyEdgeMask
A one-node Canny edge detector for your graph
- image
- IMAGE
If you've touched ControlNet, you've met Canny: that black-and-white line map of edges that drives edge-based conditioning. This node hands you the same detector inside your own graph, so you can turn any image into a Canny map without leaving ComfyUI or pulling in the whole ControlNet Aux preprocessor stack. Use it to preprocess an input for a Canny ControlNet, to build a line mask for inpainting, or just to inspect how much edge structure a render actually has.
How it works
It converts the image to grayscale and runs OpenCV's Canny() with two thresholds. The clever bit of Canny is exactly this two-threshold design: lower_threshold catches weak edges that connect to strong ones, upper_threshold decides what counts as a definite edge. The gap between them is where you control how much noise becomes linework.
- lower_threshold (0–500, default 100) - the sensitivity floor. Drop it to catch faint edges; raise it to kill noise.
- upper_threshold (0–500, default 200) - the confidence bar. Lowering it toward the lower threshold gives you more, noisier edges.
Output is an IMAGE (a grayscale map of 0/255 line pixels). Note the honest quirk: unlike the pack's HSVThresholdMask, this node does not normalize to 0–1 - edges come back at a value of 255, not 1.0. If you're feeding it into something that expects a clean normalized mask, run it through ComfyUI's ImageToMask or a threshold first.
Install
CannyEdgeMask is one of ~22 nodes in ComfyUI-post-processing-nodes.
- ComfyUI Manager: search "post processing nodes", install, restart.
- Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/EllangoK/ComfyUI-post-processing-nodes
Restart after. No requirements.txt or model downloads - it just needs cv2, which stock ComfyUI ships. It's under postprocessing → Masks in the node menu.
Making it useful
For ControlNet preprocessing, the usual starting point is 100/200 (the defaults) and tune from there: busy scenes want the upper threshold raised to suppress texture noise; clean product shots can drop both thresholds to get more linework. For mask building, invert it - you're usually after the areas between the lines. And if you're thinking "why not just use the ControlNet aux pack," the answer is that this node is ~20x simpler to wire up when you want a raw edge map and nothing else.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| lower_threshold | INT | 1000–500 | — |
| upper_threshold | INT | 2000–500 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |