Imgutils Edge (Lineart Anime)
Lineart that doesn't butcher anime lines
- image
- image
If you've ever fed a Canny pass into a ControlNet and watched it shred a character's clean linework into a thousand jagged specks, this is the node for you. Imgutils Edge (Lineart Anime) extracts lineart the way anime art actually has lineart: closed, confident, mostly-straight strokes instead of an edge map that looks like a bad photocopy. It's the same model family behind the lineart_anime ControlNet preprocessor, and it exists because anime style is mostly flat color plus line, so edge detection tuned for photographic edges is fighting the source material instead of reading it.
It's one node in the xiaden/comfyui-imgutils pack, which wraps the deepghs/imgutils library - a well-used anime image-analysis toolbox. Under the hood the node calls edge_image_with_lineart_anime, a neural lineart extractor (not a hand-rolled Sobel). You feed it an image and it runs a model that was trained to output clean anime-style lineart, then hands you the result as an IMAGE. That's the whole flow: image in, lineart out, no threshold fiddling.
The only real knob is detect_resolution, default 512 (range 128–2048, step 64). This is the resolution the detector runs at internally. 512 is a sane default and matches what the preprocessors in most workflows use; you generally only raise it if the source is big and detail is getting lost, at the cost of speed and VRAM. Drop it low and you get coarser, chunky lines - which is occasionally a look you want.
The single output, image, is the lineart. Wire it into a ControlNet loader with an lineart_anime control model and you've got the conditioning setup that shows up constantly in character-consistency workflows - reference + lineart keeps a character recognizable across scenes better than most other controls. You can also use it straight as a sketch source: generate lineart from a drawing, then img2img over it.
Install
Everything in this pack installs the same way. The reliable path:
cd ComfyUI/custom_nodes/
git clone https://github.com/xiaden/comfyui-imgutils.git
cd comfyui-imgutils
pip install -r requirements.txt
then restart ComfyUI. The dependency that matters is dghs-imgutils[gpu]>=0.19.0, which pulls in the GPU-accelerated ONNX runtime. Two gotchas: this pack is written against ComfyUI's newer V3 backend API, so it needs ComfyUI 0.25.0 or newer - on an older install the nodes just won't appear. And there's no manual model download; the lineart model is fetched from HuggingFace Hub on first run and cached in ~/.cache/huggingface/hub/, so the first run is slow and offline machines stay offline.
Troubleshooting
- Node missing from the menu. Check your ComfyUI version first; anything under 0.25.0 can't register V3 nodes.
- First run hangs. That's the model downloading. Let it finish once; subsequent runs are fast.
- Lines look noisy instead of clean. Raise
detect_resolutiontoward the source size, and check you're not feeding a compressed JPEG that's already full of artifacts - lineart extractors amplify noise.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | Input image to detect anime edges. | |
| detect_resolution | INT | 512128–2048 | Detection resolution. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |