HED Soft-Edge Lines
The forgiving edge detector for organic subjects
- image
- IMAGE
HED gives you soft edges - gradient-y lines with varying thickness - instead of the hard, thin, binary edges Canny produces. That softness is the entire reason it exists. Canny wants clean contours and clear contrast; hand it a face, hair, fur, or foliage and it either misses edges or shreds them into noise. HED is forgiving. It captures the sense of an edge without demanding a perfect one, which makes it the go-to line extractor for organic, soft, or textured subjects feeding a softedge ControlNet.
How it works
HED stands for Holistically-nested Edge Detection - a neural edge detector (weights: ControlNetHED.pth) rather than the classic Canny algorithm. It looks at the image at multiple scales and predicts where edges are, producing a grayscale map where line strength fades in and out rather than snapping between black and white. A softedge ControlNet is trained on exactly this kind of gradient map, so it reads HED output naturally and reconstructs structure while leaving the model room to invent detail Canny would have locked down.
In plain terms: Canny traces, HED suggests. For a portrait or a landscape, suggesting is what you want.
The inputs and output
Two inputs actually matter:
image- your source.resolution(default 512) - the processing size; match it to your render for the cleanest map.
Then there's the one people ask about:
safe(defaultenable) - "safe mode." It quantizes the edge intensities so the ControlNet doesn't latch onto faint hidden gradients and hallucinate structure that isn't really there. Leave it on unless you're deliberately chasing every last wisp of detail and don't mind some artifacts; then try disabling it and compare.
The single output is an IMAGE - the soft-edge map. Wire it into a ControlNet Apply node with a softedge ControlNet (control_v11p_sd15_softedge, or the older control_hed). As always, the map does nothing until that model is loaded.
Installing it
ComfyUI Manager: search ComfyUI's ControlNet Auxiliary Preprocessors, install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/comfyui_controlnet_aux
pip install -r requirements.txt
Restart ComfyUI. The ControlNetHED.pth weight downloads from HuggingFace on first run - a one-time pause.
Where people get burned
Honest positioning first: HED is the older softedge model, and for most people PiDiNet (another node in this pack) now produces cleaner soft edges for the same job. If you're starting fresh, try PiDiNetPreprocessor and keep HED as the fallback when PiDiNet's lines feel too thin or too clean for your subject. They both target the same control_v11p_sd15_softedge model, so swapping between them is a one-node change.
Second, the mismatch trap: HED into a softedge or scribble ControlNet is right; HED into a Canny or lineart ControlNet is not. The preprocessor and the ControlNet model have to speak the same language. Feed a soft gradient map to a model trained on hard thin lines and you get mush.
And the universal one: no softedge ControlNet loaded means the pretty edge map you're previewing has zero effect on the generation. The node makes the hint; the model is separate.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| safeopt | COMBO | enable | 2 options: enable, disable |
| resolutionopt | INT | 51264–16384 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |