ComfyUI Node

Blue Sketch Cleaner

Blue pencil in, clean black line art out — the OpenToonz trick minus the 90s UI

By l2dnjsrud·Created 3 months ago·Updated 3 months ago· 0
Blue Sketch Cleaner
  • image
  • clean_line
  • line_overlay
  • transparent_line_preview
  • settings_json
hue_low90
hue_high145
saturation_min28
value_min20
include_dark_linesfalse
despeckle_px8
close_px1

If you rough manga or manhwa panels in blue pencil, the blue is doing double duty: it tells you where the ink will go, and it tells a colorizer "don't treat this as content." The problem is that every AI model you hand the page to - Qwen Image Edit, MangaNinja, a ControlNet lineart pass, whatever you're using downstream - just sees blue scribbles smeared over the art. Blue Sketch Cleaner is the node that fixes that. It pulls the blue strokes out of a rough sketch and hands you a normalized black-on-white line image, which is exactly the input a line-gap closer or a colorizer actually wants.

The pack this lives in is called ComfyUI-OpenToonzLineTools, and the name undersells it. It isn't a port of OpenToonz - no C++ bindings, no timeline, no .tlv files. What the author (a Korean researcher whose README is aimed at a sketch-to-color pipeline) took from OpenToonz is the idea of scan cleanup, the "cleaning-up scanned drawings" workflow that studio tool has done since forever. So this node is deliberately old-school: it's a color threshold, not a neural model.

How it works

The mechanism is plain HSV thresholding, done with numpy and OpenCV. It converts the image to HSV, then keeps pixels whose hue lands between hue_low and hue_high, whose saturation is at least saturation_min, and whose brightness is at least value_min. Everything else becomes white. There's a morphological close pass, then a despeckle pass that deletes connected specks smaller than despeckle_px pixels. That's the whole brain. No model files, no VRAM, no download - it runs in a millisecond on CPU.

The inputs that actually matter

  • hue_low / hue_high - the blue range, and here's the trap: these are OpenCV hue values on a 0–179 scale, not degrees. The defaults of 90–145 cover cyan through purple-blue. If your strokes run more violet or more green, nudge the range; the code even handles wrapping if you set low above high.
  • saturation_min and value_min - your faint-pencil dials. Lower them when the blue is barely there; raise them when pale paper grain gets selected.
  • include_dark_lines - flips the node into "keep black lines too," useful for mixed blue+black panels. Turn it on and immediately check the overlay, because it will happily swallow text, panel borders, and shadows.
  • despeckle_px - dust removal. Raise it when your scan is dirty, not when your line work is thin.

Outputs

You get four. clean_line (black strokes on white - this is the one you wire forward), line_overlay (the source image with detected strokes tinted red, your debugging view), transparent_line_preview, and settings_json (the exact parameters plus per-image stats like line_pixels and line_ratio, which is genuinely useful for spotting when it has grabbed half the page).

Installing it

Through ComfyUI Manager, search for comfyui-opentoonz-line-tools, or:

cd ComfyUI/custom_nodes
git clone https://github.com/l2dnjsrud/ComfyUI-OpenToonzLineTools.git

Restart ComfyUI and the nodes appear under manga/opentoonz-line-tools. Dependencies are just numpy, opencv-python, and Pillow - no torch install (the author explicitly warns you not to reinstall torch from this pack; use the one your ComfyUI already has). No model files to hunt down.

Where people get burned

Mostly it's the hue scale - treating 90–145 as degrees and wondering why nothing matches. Second is include_dark_lines on autopilot, which turns a clean extractor into a text-and-border magnet; the overlay output exists precisely so you check it. And be honest about what this pack is: it's small, young, and not exactly battle-tested - searching reddit for it turns up nothing and comfy.icu shows it's barely used. Treat the overlay as the source of truth, tune saturation_min when paper reads as blue, and it earns its place as the front end of the cleanup → gap-close → region-map → colorization chain.

Categorymanga/opentoonz-line-tools

Inputs (8)

NameTypeDefaultDescription
imageIMAGE
hue_lowINT900–179
hue_highINT1450–179
saturation_minINT280–255
value_minINT200–255
include_dark_linesBOOLEANfalse
despeckle_pxINT80–4096
close_pxINT10–16

Outputs (4)

NameTypeDescription
clean_lineIMAGE
line_overlayIMAGE
transparent_line_previewIMAGE
settings_jsonSTRING