Extensions/ComfyUI-BlueMangaPanelSplitter
ComfyUI Extension

ComfyUI-BlueMangaPanelSplitter

ComfyUI custom node for splitting blue-pencil manga manuscript pages into story panels.

By l2dnjsrud·Created 3 months ago·Updated 3 months ago· 0
l2dnjsrud/ComfyUI-BlueMangaPanelSplitter
Nodes
On cloudLocal install
Stars0
Updated3 months ago
Readme

ComfyUI Blue Manga Panel Splitter

한국어 문서: README.ko.md

ComfyUI custom node for splitting blue-pencil manga manuscript pages into story panels.

The node is tuned for Mr. Blue-style production pages with:

  • blue rough pencil lines,
  • rectangular panel/page frames,
  • a left-side production sheet/table,
  • rough internal panel dividers.

It writes cropped panel images and an editable layout.json to the ComfyUI output folder.

Install

Clone this repository into your ComfyUI custom_nodes folder:

cd /path/to/ComfyUI/custom_nodes
git clone https://github.com/l2dnjsrud/ComfyUI-BlueMangaPanelSplitter.git

Install the extra Python dependencies in the ComfyUI environment:

cd /path/to/ComfyUI
source .venv/bin/activate
pip install -r custom_nodes/ComfyUI-BlueMangaPanelSplitter/requirements.txt

Restart ComfyUI.

Node

After restart, add:

manga/panels -> Blue Manga Panel Splitter
manga/panels -> Blue Manga Frame Panel Splitter
manga/panels -> Blue Manga Spread Panel Splitter
manga/panels -> Blue Manga Panel Crop
manga/panels -> Blue Manga Panel Reassemble

Inputs:

  • image: ComfyUI IMAGE
  • output_folder: folder under ComfyUI output/
  • page_name: subfolder name for this page
  • settings_path: optional YAML settings path

Outputs:

  • overlay: image with numbered panel boxes
  • layout_json: editable JSON string
  • output_dir: path where crops and layout were written

Blue Manga Panel Crop takes the original page image plus layout_json, selects one panel by panel_index, and outputs that panel as an IMAGE tensor. Leave target_width and target_height at 0 to auto-size from the detected bbox while preserving aspect ratio. auto_max_side also defaults to 0, so the detected panel size is not capped unless you set a limit manually. The node also outputs width and height INT values that can be linked into EmptyLatentImage. This lets the same ComfyUI graph continue from page layout splitting into ControlNet, img2img, or another coloring workflow without manually loading or sizing each saved crop.

Blue Manga Frame Panel Splitter is a separate splitter for pages with strong page frame lines and simple row/column divisions. It prioritizes long horizontal and vertical blue frame lines, so it is better for wide establishing shots or two-page layouts where the contour splitter may mistake buildings, title boxes, or speech boxes for panels.

Blue Manga Spread Panel Splitter is the preferred splitter for two-page manga spreads that contain multiple panels on each side. It first detects the center spread/page divider, then looks for horizontal and vertical frame lines inside each page region. Use this for most storyboard pages with clear rectangular gutters. If it misses a small inset panel, edit layout.json or fall back to the contour splitter for that page.

Blue Manga Panel Reassemble takes the original page image, the same layout_json, and colored panel images named panel_001, panel_002, and so on. Connected panels are resized back to their bbox and pasted onto the original page; missing panel inputs are left untouched.

Written files:

output/<output_folder>/<page_name>/
  _source.png
  overlay.png
  layout.json
  panels/panel_001.png
  panels/panel_002.png

Each panel entry has:

{
  "id": "panel_001",
  "bbox": [x, y, w, h],
  "path": "panels/panel_001.png"
}

Example Workflows

ComfyUI UI workflow:

examples/blue_manga_panel_splitter_ui.json

ComfyUI API workflow:

examples/blue_manga_panel_splitter_api.json

Both workflows use:

LoadImage -> Blue Manga Panel Splitter -> SaveImage

Frame-line UI workflow:

examples/blue_manga_frame_panel_splitter_ui.json

Frame-line API workflow:

examples/blue_manga_frame_panel_splitter_api.json

These workflows use:

LoadImage -> Blue Manga Frame Panel Splitter -> SaveImage

Spread-aware UI workflow:

examples/blue_manga_spread_panel_splitter_ui.json

Spread-aware API workflow:

examples/blue_manga_spread_panel_splitter_api.json

These workflows use:

LoadImage -> Blue Manga Spread Panel Splitter -> SaveImage

Split-to-color UI workflow:

examples/blue_manga_split_to_color_ui.json

Split-to-color API workflow:

examples/blue_manga_split_to_color_api.json

These workflows use:

LoadImage -> Blue Manga Panel Splitter -> Blue Manga Panel Crop -> ControlNet color branch -> Blue Manga Panel Reassemble -> SaveImage

The included color branch targets one selected panel at a time and reconnects it as panel_001 in the reassemble node. Duplicate the crop/color branch and connect each decoded result to panel_002, panel_003, and so on to rebuild more of the page in one graph.

Use the UI workflow when you want to load it directly in the ComfyUI graph. Use the API workflow when you want to queue it through /prompt.

Notes

  • This is a classical OpenCV detector, not a trained segmentation model.
  • It is conservative by design and may need manual layout.json cleanup.
  • It protects narrow left-side production sheet regions by default.
  • Slanted gutters and open hand-drawn borders are a future segmentation-model target.