Nodes/imgutils/Imgutils Edge (Canny)
ComfyUI Node

Imgutils Edge (Canny)

The ControlNet Preprocessor

By xiaden·Created 2 months ago·Updated 2 months ago· 0
Imgutils Edge (Canny)
  • image
  • image
low_threshold100
high_threshold200

Canny is the oldest, most reliable trick in the ControlNet preprocessor book: turn an image into a clean set of hard edges and let the model redraw within them. Imgutils Edge (Canny) is that classic, implemented inside the imgutils pack with two knobs - low_threshold and high_threshold - and nothing else. No model files, no downloads, deterministic as a ruler.

Why you'd reach for it

The KB's controlnet doc puts it simply: Canny is the classic, best for architecture, mechanical objects, and scenes with clear contours. When your subject has well-defined edges, Canny gives ControlNet the most faithful blueprint, and it's the condition people reach for when they want structure without style bleed. If you're building an anime or SDXL workflow in this pack anyway - tagging, detection, upscaling - having the edge preprocessor one drag away means one fewer pack installed.

How it works

Under the hood it wraps edge_image_with_canny from imgutils, which runs the standard Canny algorithm on your image in PIL-land. Canny works in two stages: it finds all gradient changes, then uses the two thresholds to decide which are real edges. Anything above high_threshold is definitely an edge; anything below low_threshold is discarded; everything between is kept only if it touches a confirmed edge. That two-threshold design is why both knobs exist.

The inputs that matter

  • image - the source.
  • low_threshold (default 100, 0–500, step 10)
  • high_threshold (default 200, 0–500, step 10)

Rule of thumb: keep high around 2× low. Too low a low-threshold and the output fills with texture noise; too high and real edges disappear. The defaults (100/200) are the classic starting point and work for most clean anime linework - tune only if edges look too noisy (raise both) or too sparse (lower both).

Output is a single image edge map, ready to feed a ControlNet loader.

Honest take

Be straight about it: ComfyUI core ships a Canny preprocessor already, so this is a convenience and consistency play, not a capability you couldn't otherwise get. What it buys you is staying inside one pack and getting the exact same edge pipeline the imgutils family uses. One place Canny genuinely shines in a modern workflow: it's one of the conditions that survived the ControlNet ecosystem consolidation intact, so it still has union coverage on every current base (SDXL, Illustrious, Flux-era unions all keep canny). If you want softer, drawn-looking lines instead of hard threshold edges, the sibling Imgutils Edge (Lineart) is the upgrade.

Install

cd ComfyUI/custom_nodes
git clone https://github.com/xiaden/comfyui-imgutils.git
cd comfyui-imgutils
pip install -r requirements.txt

Or via ComfyUI Manager (search "imgutils"). Requires ComfyUI >= 0.25.0 and Python >= 3.10; pack dependency is dghs-imgutils[gpu]. This node downloads nothing - it's pure threshold math on CPU.

Troubleshooting

An edge map that looks like static means your low_threshold is too low for that image - raise it. A map with big empty gaps means high_threshold is too high - lower it. And if edges come out thicker than you expected at 512px but fine on larger images, that's resolution, not the node: preprocess at the resolution your ControlNet was trained at, not the render resolution.

Categoryimgutils/edge

Inputs (3)

NameTypeDefaultDescription
imageIMAGEInput image to detect edges.
low_thresholdINT1000–500Canny low threshold.
high_thresholdINT2000–500Canny high threshold.

Outputs (1)

NameTypeDescription
imageIMAGE