modaux: pidi
Modaux pidi for soft edges and scribbles
- image
- IMAGE
Canny is ruthless: it finds every hard edge and draws it in hair-thin black and white. PidiNet is the opposite temperament - it produces soft, gradient edges with varying thickness, which is exactly what you want when the subject is organic (people, plants, animals) and a perfect outline would fight the model. It's the "softedge" preprocessor in the ControlNet 1.1 lineup, and it doubles as a scribble generator when you want the rough-sketch look.
In ComfyUI it's modaux: pidi, from the ControlNet Auxiliar pack. One thing to know up front: the pack's own README calls PidiNet "image inpainting," which is just wrong - the code is unambiguous that it's a PidiNet edge detector. Don't let the README talk you out of it.
How it works
The node runs PidiNetDetector from Hugging Face's controlnet_aux (the table5_pidinet.pth weights, downloaded from lllyasviel/Annotators on first run). PidiNet is a lightweight CNN trained for edge detection, and controlnet_aux layers a few post-processing tricks on top. That's where its three optional toggles come in:
- safe (default true) - steps out faint noise so the map isn't speckled with garbage. Leave it on.
- apply_filter (default true) - thresholds weak edges away, leaving only confident ones.
- scribble (default true) - the fun one. Turns the soft edges into a rough, sketchy black-and-white scribble via non-maximum suppression, blur, and a hard threshold.
Here's the gotcha: the underlying detector ships with scribble off, but this pack flips it on by default. So out of the box you get the scribble look, not clean PidiNet soft edges. If you wanted a smooth gradient edge map, flip scribble off. If you want the creative-layout look - rough hand-drawn strokes the model fleshes out into detail - leave it on.
The shared inputs, detect_resolution and image_resolution (both default 512), control processing resolution and output size. Output is one IMAGE, wired into a softedge or scribble ControlNet (control_v11p_sd15_softedge on SD 1.5, the "PIDI softedge" condition on SDXL's xinsir union).
Why it beats canny for some jobs
Canny requires the image to have clean edges to detect; scribble and softedge are forgiving of rough input, which is why the scribble workflow is the most creative-friendly ControlNet recipe out there - you can hand it a rough layout doodle and let the model finish the drawing. That's the move: layout in pidi, detail in the prompt. For architecture and machinery, stick with canny; for anything alive, this is the better first try.
Installing it
Via ComfyUI Manager (search ControlNetAux, repo madtunebk/ComfyUI-ControlnetAux), or:
cd ComfyUI/custom_nodes
git clone https://github.com/madtunebk/ComfyUI-ControlnetAux
cd ComfyUI-ControlnetAux
pip install -r requirements.txt # timm, controlnet-aux==0.0.7, mediapipe
Restart ComfyUI and look under the ControlNet Auxiliar category.
Where people get burned
The name collision, again: this is the small beta "ControlNet Auxiliar" pack, not Fannovel16's comfyui_controlnet_aux that shows up in every serious ControlNet workflow - if a shared workflow references AIO_Prep or LLlyasviel* nodes, it's asking for that other pack. Also expect a slow first run while the weights download, and remember the pinned controlnet-aux==0.0.7 plus mediapipe are the two dependencies most likely to break a startup if your Python environment is fussy.
And one genuinely useful tip that applies to this node more than any other in the pack: the defaults are set for scribble, so the first image you get out of it will look like a doodle. That's not a bug - but if it's not the look you wanted, the toggle is right there.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| detect_resolution | INT | 512256–1024 | — |
| image_resolution | INT | 512256–1024 | — |
| safeopt | BOOLEAN | true | — |
| scribbleopt | BOOLEAN | true | — |
| apply_filteropt | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |