LineArt Preprocessor (nikosis)
Ink-style line art from any photo, two sliders, zero model downloads
- image
- IMAGE
Lineart ControlNets are what you reach for when Canny's harsh pixel-thin edges feel wrong - think character art, manga-ish illustration, and the "reference + lineart" trick for keeping a character consistent across scenes. This node extracts that ink-style linework from any image, and the whole thing is pure OpenCV. No weights, no first-run download, no model files to babysit. Install the pack, and it works.
How it works
The algorithm is the classic "standard" lineart formula from the original ControlNet annotators, verbatim. It Gaussian-blurs the image, subtracts the sharp original from the blur, and takes the minimum across color channels. Where an edge exists, the blurred version is dimmer than the original, so that subtraction lights up - dark ink at every boundary, nothing on flat regions. Then it normalizes the result against the median intensity of the pixels that cleared your threshold and scales it up.
That's why this node is a good "don't bother installing controlnet_aux" option: it gives you genuine ControlNet-style lineart maps with a dependency list of one (opencv-python).
Inputs that matter
- image - your input.
- sigma (default 6, 0.1–100) - the Gaussian blur radius, and the main line-thickness control. Higher sigma = thicker, softer, cleaner lines with less noise. Lower sigma = fine, tight lines. If the output looks like scribble soup, raise sigma.
- intensity (default 8, 0–16) - the sensitivity threshold. It decides which faint edges count when computing the normalizer. Lower values keep more delicate linework; higher values only keep strong ink. Start at the default, tune sigma first.
- model - a dropdown with a single entry, "standard". It's a fixed value; there's no other choice, so ignore it.
- resolution (default 1024, 64–2048) and keep_proportion (default on) - the same pair as every node in this pack: resolution targets the shorter side, keep_proportion crops vs. stretches to multiples of 16.
Output is one IMAGE: the line map, three channels, ready to feed into a lineart ControlNet. One honest caveat: the output is dark-ink-on-light, which is what the classic lineart ControlNet expects - if your model wants the inverted map, flip it downstream.
Installing it
This node is part of the ComfyUI-Nikosis-Preprocessors pack from Nikosis (the same author as the ComfyUI-Nikosis-Nodes prompt/style pack that shows up in r/comfyui recommendations). Install via ComfyUI Manager - search ComfyUI-Nikosis-Preprocessors, Install, restart - or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/Nikosis/ComfyUI-Nikosis-Preprocessors comfyui-nikosis-preprocessors
cd comfyui-nikosis-preprocessors
pip install -r requirements.txt # Windows portable: ..\..\..\python_embeded\python.exe -m pip install -r requirements.txt
Restart afterwards. The relevant dependency is opencv-python (in requirements.txt); a cv2 import error means it's missing.
Gotchas
- If you wanted clean, anime-style linework, this isn't it - that's what this pack's LineArt Sketch node (the one that runs an actual model) is for. This node gives you natural, photo-derived lineart.
modelhas one option and that's not a bug. Don't hunt for a hidden download.- Lineart maps hold up great for character consistency workflows, which the KB notes is the community's favorite use - but give the ControlNet weight a nudge down from 1.0 if the result over-constrains your pose.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| model | COMBO | standard | 1 options: standard |
| sigma | FLOAT | 6.000.1–100 | — |
| intensity | INT | 80–16 | — |
| resolution | INT | 102464–2048 | — |
| keep_proportion | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |