ComfyUI Node

modaux: hed

The soft edge preprocessor that plays nice with organic subjects

By madtunebk·Created 2 years ago·Updated 2 years ago· 17
modaux: hed
  • image
  • IMAGE
detect_resolution512
image_resolution512
safefalse
scribblefalse

ControlNet edge control usually starts with Canny: crisp, thin lines, everything else discarded. Canny is superb for architecture and machinery, but the moment you feed it a portrait or any soft organic subject it turns into a fence - every pore and stray hair becomes a line and the condition starts fighting your prompt. HED (modaux: hed in the ControlNet Auxiliar pack) has the opposite temperament. It's a "soft edge" detector, producing gradient edges of varying thickness instead of hard binary lines. Because the map gives the model room to interpret, HED-derived softedge maps became the classic choice for people, animals, and anything with a natural silhouette.

The node is a thin wrapper over Hugging Face's controlnet_aux - the same library behind the "ControlNet Auxiliary Preprocessors" pack you see in every tutorial. Everything this node does, that pack does too. This one just ships fewer nodes and an older pin.

How it works

Under the hood is the HED network - Holistically-Nested Edge Detection. The "holistically nested" part means it blends edge maps from several depths of the network, which is what gives those smooth, continuous edges instead of Canny's broken fragments. The weights (ControlNetHED.pth) live in the lllyasviel/Annotators repository on Hugging Face, so the first run downloads a few hundred MB - one time, needs internet.

Two toggles change what comes out:

  • safe (default off) - masks out the background, leaving edges floating on black. This is the "softedge_safe" look, usually the more ControlNet-friendly of the two because the condition is cleaner.
  • scribble (default off) - runs the edge map through non-maximum suppression and a blur, turning it into rough hand-drawn sketch strokes. That output pairs with scribble ControlNets, and it's a handy shortcut to "interpret my rough layout" workflows without drawing anything yourself.

Inputs that matter

  • image - what you're extracting edges from.
  • detect_resolution / image_resolution - both default 512 (range 256–1024). Detection happens at the first, output resizes to the second. Leave them alone until you know why you're changing them.
  • safe and scribble - the two booleans above.

One genuine quirk of this pack: the boolean labels are wired backwards. A checkbox can read "enabled" while it's off and "disabled" while it's on, which has sent more than one person chasing the wrong behavior. Trust the defaults (both off), flip a toggle, and judge by the preview rather than the label.

The single IMAGE output goes into the control-image input of your ControlNet apply node, paired with an SD-era softedge/HED checkpoint.

Install

Manager → search "ControlNet Auxiliar" → install, or:

cd ComfyUI/custom_nodes
git clone https://github.com/madtunebk/ComfyUI-ControlnetAux.git
cd ComfyUI-ControlnetAux
pip install -r requirements.txt   # timm, controlnet-aux==0.0.7, mediapipe

Restart, and run it once to trigger the Annotators download before you build a workflow around it. A silent first-run download in the middle of a real generation is how people end up blaming the wrong node.

The honest caveat

This pack's last commit was mid-2024 and it pins controlnet-aux==0.0.7. If a tutorial's workflow references a modaux: hed node by that exact name, you're in the right place - otherwise the maintained "ControlNet Auxiliary Preprocessors" pack gives you HED, softedge, and scribble with more control and saner labels. HED itself is still the soft-edge standard even in 2026. It's the wrapper that aged, not the algorithm.

CategoryControlNet Auxiliar

Inputs (5)

NameTypeDefaultDescription
imageIMAGE
detect_resolutionINT512256–1024
image_resolutionINT512256–1024
safeoptBOOLEANfalse
scribbleoptBOOLEANfalse

Outputs (1)

NameTypeDescription
IMAGEIMAGE