Source two: extracting raster lineart
✅ verified
What this section is for
A contour has only a part’s outer edge; the structural lines inside a part – the direction of the strands, the folds in a skirt, the eye socket – are not on it. Those come from a model made for extracting lineart: give it the source, and it gives back raster lineart, white lines on black. This section is about what that is, how to choose one, and how to swap it.
Concepts
Raster lineart: a greyscale image the size of the source, with the lines bright and everything else black. It is pixels, not curves; turning it into individual strokes goes through 2.3 Skeletonizing.
Single-pixel lines: a line whose skeleton is one pixel wide, so its endpoints and junctions can be counted. That is what skeletonizing needs; a thick line with grey levels grows whiskers when thinned, and a solid block thins into a tangle.
Extractor: the model or algorithm that produces raster lineart. This handbook uses one (Manga2Anime) and produces two more every time purely for comparison (AnimeLineArt and LineartStandard); there are others, none of which has been run.
How to choose one
The three linearts differ only in the extraction; after that they all go down the same road. The criteria are what skeletonizing needs:
| what to look at | why |
|---|---|
| single-pixel lines, or thick lines with grey levels | a thick line’s skeleton runs down its middle, and grey edges grow whiskers that break it into fragments unless they are pruned cleanly |
| is the eye drawn as an outline or as a solid block | a solid block thins into a tangle and the eye’s lines are lost entirely |
| are the strands of hair separable | strands that are not separable become one thick line, and after arbitration only the outline is left |
| does it hallucinate outside the subject | some extractors draw texture in empty areas; pixels outside the subject are discarded, but a hallucination near the outline gets in |
The method
- The source goes to ComfyUI, which produces all three extractors’ output at once, one image each (appendix F).
- Everything downstream reads only the manga one.
- Skeletonizing (2.3).
Swapping the source
This step always reads Manga2Anime; ch. 4’s per-layer lineart has a knob for which extractor each layer uses. To add a new extractor: add a pair of nodes to the ComfyUI graph (the extractor and a save), name its output after the extractor, following the pattern in appendix F, and nothing else changes.
Further reading
- Code: appendix B, under
lineart– the ComfyUI driver. - Reference: ComfyUI’s controlnet preprocessor collection, which holds all three extractors, https://github.com/Fannovel16/comfyui_controlnet_aux.