Nodes/imgutils/Imgutils Edge (Lineart)
ComfyUI Node

Imgutils Edge (Lineart)

Lines That Read Like a Drawing

By xiaden·Created 2 months ago·Updated 2 months ago· 0
Imgutils Edge (Lineart)
  • image
  • image
coarsefalse
detect_resolution512

Canny gives you hard threshold edges; lineart gives you something that actually looks like a drawing. Imgutils Edge (Lineart) runs a neural lineart model - the same family of model the ControlNet lineart preprocessors use - to extract clean, expressive outline art that reads as intentional ink rather than gradient noise. If you're doing character work, this is often the better preprocessor than Canny.

Why you'd reach for it

The KB's controlnet doc is blunt about it: lineart is the preferred conditioning for character consistency. Where Canny excels on mechanical/architectural subjects, lineart's softer, sketch-like lines transfer better to people and characters - the outline structure survives while the model gets room to fill in a natural style. Wire the output into a lineart ControlNet and you can re-pose or re-render a character while keeping their silhouette intact. It's also the right tool when you want the output to look inked - the classic anime-lineart-to-color pipeline.

How it works

Unlike Canny's threshold math, this uses a trained model to decide where the meaningful lines are, so it ignores texture and lighting changes that trip up edge detectors and follows actual contours. Two inputs shape the run:

  • coarse (BOOLEAN, default false) - when true, it uses the coarse variant of the model for deeper, richer, bolder strokes - more of a sketch. When false, you get the cleaner fine lineart.
  • detect_resolution (INT, default 512, 128–2048, step 64) - the resolution the image is resized to before the model runs. Higher = more detail captured, slower. 512 is the standard starting point.

Output is a single image edge map.

Honest take

Two things worth knowing before you grab this one. First, there's a sibling node - Imgutils Edge (Lineart Anime) - which is the anime-specific variant with a detect_resolution knob and nothing else. If your target ControlNet was trained on anime lineart, that's the one you want; this node is the general/realistic-leaning lineart. Second, coarse=true is genuinely nice for stylized work, but on busy images the bold strokes can mush details together - keep it off unless you've seen what it does to your images.

Also expect a first-run download: the lineart model is fetched from HuggingFace Hub on first use and cached in ~/.cache/huggingface/hub/. It's small relative to the taggers, but it's not nothing.

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"). Needs ComfyUI >= 0.25.0 and Python >= 3.10; dependency is dghs-imgutils[gpu].

Troubleshooting

Edges too thin or broken at low resolution? Bump detect_resolution toward 768. Output looking heavier than you wanted? Check that coarse is actually off - it's the most common accidental toggle. And if the first run just sits there for a minute, it's the model download, not a hang - watch the HF cache folder grow or your console for progress. If your ControlNet still ignores the map, verify the lineart controlnet type matches the node: general lineart controlnets for this node, anime-lineart controlnets for the sibling.

Categoryimgutils/edge

Inputs (3)

NameTypeDefaultDescription
imageIMAGEInput image to detect edges.
coarseBOOLEANfalseUse coarse model for deeper/richer lines.
detect_resolutionINT512128–2048Detection resolution.

Outputs (1)

NameTypeDescription
imageIMAGE