ComfyUI Extension: comfyui-opentoonz-line-tools
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.
OpenToonz-inspired cleanup, gap closing, and palette-region ComfyUI nodes for rough blue manga manuscripts.
Looking for a different extension?
Custom Nodes (3)
README
ComfyUI OpenToonz Line Tools
OpenToonz-inspired ComfyUI custom nodes for rough blue manga/manhwa manuscripts.
This project does not embed or port the full OpenToonz application. It extracts the useful production ideas for the current sketch-to-color research pipeline:
- scan-style blue line cleanup,
- gap closing before region fill,
- region/palette maps for later color correction.
The intended upstream/downstream flow is:
blue rough panel crop
-> Blue Sketch Cleaner
-> Line Gap Closer
-> Color Region Finder
-> Qwen Image Edit / MangaNinja / reference colorization
-> panel reassemble
Why These Features
OpenToonz is strongest in traditional 2D animation cleanup, ink/paint, palette management, and compositing. For this research, the reusable ideas are not the UI or timeline; they are the low-level line-preparation steps that make rough art more fillable and controllable.
Relevant OpenToonz references:
- Cleaning-up Scanned Drawings
- Painting Animation Levels
- Managing Palettes and Styles
- OpenToonz source tree
Nodes
See the full parameter guide:
Blue Sketch Cleaner
Classifies blue rough pencil strokes and emits a normalized black-on-white line image plus an overlay preview.
Internal workflow id: OTBlueLineCleanup
Outputs:
clean_line: white background with black extracted linesline_overlay: source image with detected strokes tinted redtransparent_line_preview: line-only preview on whitesettings_json: exact parameters used
Line Gap Closer
Finds skeleton endpoints and draws short closure segments when endpoint distance and direction are compatible.
Internal workflow id: OTLineAutoClose
Outputs:
closed_line: line image after gap closureclosure_overlay: original black lines plus red closure strokessegments_json: closure segment coordinates
Color Region Finder
Labels fillable regions separated by line art and returns a JSON list of region metadata. This is the first step toward OpenToonz-style indexed color editing.
Internal workflow id: OTRegionPaletteMap
Outputs:
region_preview: colored region-label preview with black line artregions_json: bbox, area, centroid, and style id for each region
Install
Clone or copy this folder into ComfyUI custom nodes.
On another ComfyUI installation:
cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/l2dnjsrud/ComfyUI-OpenToonzLineTools.git
The repository is public, so another ComfyUI install can clone it without GitHub authentication.
On this Mac, using the development copy by symlink is fine:
cd /Users/iwongyeong/AI/ComfyUI/custom_nodes
ln -s /Users/iwongyeong/AI/ComfyUI-OpenToonzLineTools ComfyUI-OpenToonzLineTools
Install dependencies in the ComfyUI environment if needed:
cd /path/to/ComfyUI
source .venv/bin/activate
pip install -r custom_nodes/ComfyUI-OpenToonzLineTools/requirements.txt
deactivate
Do not reinstall or upgrade torch from this node. Use the torch build that
already belongs to that ComfyUI installation, especially on CUDA or MPS setups.
Restart ComfyUI. Nodes appear under:
manga/opentoonz-line-tools
Example Workflows
Use the UI workflow when opening a graph in the ComfyUI canvas:
examples/opentoonz_line_tools_basic_ui.json
This graph is:
LoadImage
-> Blue Sketch Cleaner
-> Line Gap Closer
-> Color Region Finder
-> SaveImage debug outputs
Before queuing it, put a rough panel image into the ComfyUI input folder and
select it in the LoadImage node. The placeholder filename is panel_001.png.
Use the API prompt version only for /prompt-style scripted runs:
examples/opentoonz_line_tools_basic_api.json
Full-Page Inputs
For high-resolution full manga/manhwa pages, use these nodes after panel detection and cropping whenever possible.
Blue Sketch Cleaner can be useful on full pages as a quick line-extraction
preview, but Line Gap Closer and Color Region Finder are designed for
panel crops or other bounded line-art regions. On full pages with many panels,
speech balloons, perspective grids, and layout borders, endpoint counts can
become too high and region maps can hit the max_regions cap.
Use the local evaluator to check a YOLO-style research set:
cd /path/to/ComfyUI/custom_nodes/ComfyUI-OpenToonzLineTools
/path/to/ComfyUI/.venv/bin/python scripts/evaluate_research_images.py \
--dataset-root /path/to/dataset \
--output-dir outputs/research_eval
Panel crop folders can be checked directly as well:
/path/to/ComfyUI/.venv/bin/python scripts/evaluate_research_images.py \
--image-root /path/to/panels \
--output-dir outputs/panel_eval
Verification
Run the smoke tests with the ComfyUI Python environment:
cd /path/to/ComfyUI/custom_nodes/ComfyUI-OpenToonzLineTools
/path/to/ComfyUI/.venv/bin/python -m unittest discover -s tests -v
Current Scope
Implemented:
- OpenToonz-inspired blue cleanup baseline
- endpoint-based line autoclose
- fillable region labeling and palette-preview JSON
- ComfyUI node wrappers
- English/Korean docs and visual pipeline notes
Not implemented yet:
- direct OpenToonz C++ binding
- TLV/PLI file support
- full palette-index raster format
- semantic inking or AI colorization models
Recommended Next Experiment
Use the current Mr.Blue v5 polygon crops as input and compare:
- raw crop -> Qwen Image Edit,
- cleanup crop -> Qwen Image Edit,
- cleanup + autoclose + region map -> reference colorization/correction.
Success should be measured by blue-line removal, composition retention, fill leak reduction, and whether palette/region JSON makes post-correction easier.
Run ComfyUI workflows without the setup
No installs, no CUDA version roulette, no GPU sitting idle on your bill. Bring a workflow and run it in the browser.