参考图生成版式 · Extract Layout
Steal a Comic's Panel Layout and Reuse It
- image
- layout_json
- preview
Every storyboard workflow in this pack runs one direction: layout first, image second. SodaExtractLayout runs it backwards. You hand it a finished page - someone else's comic, a magazine scan, a render you like the composition of - and it looks for the panel grid in the pixels, gives you a preview drawing of what it found, and can write the result into your project as a layout template you can build the next page on.
This is the node you reach for when the hard part isn't the art, it's the composition. Manga page design is a genuine craft and reverse-engineering a good one is faster than inventing one.
How it works
The detection lives in the soda-storyboard core library, which exposes an image-level entry point for exactly this - the same code path the plugin's reference-image import uses. It reads the image, finds panel regions, and returns a layout structure plus a way to draw a preview over the source so you can check the work with your eyes. It doesn't understand your characters or your story; it's a rectangle finder with opinions about gutters.
direction picks reading order, rtl or ltr, and this is not cosmetic. Reading order determines which detected panel becomes panel 1, and every downstream panel selector in this pack - the panel string on SodaCropPanel, the character dropdown on SodaCharacterMask - is addressed by reading order or id. Extract a manga page as ltr and your "panel 1" is the leftmost, which means the whole finishing chain is numbered backwards from how you'd actually read it.
The preview output is the node's real value. It draws the detected boxes on top of your image, so you can see immediately whether it found four panels or eight, including the one it split down the middle of a face. Detection from pixels is a heuristic - that's true of every panel detector ever shipped - and the author says as much: check the recognition preview and read the warnings before you trust the result.
What you set, what you get
Required: image, direction, save_template. Optional: project_dir and template_name.
layout_json is the STRING output: the extracted layout as JSON, one object if you fed a single image, or a list if you fed a batch. It's what you'd hand to whatever builds a project page from a template.
preview is an IMAGE of the source with the detected geometry drawn on it. Wire it to a PreviewImage node and leave it wired. Every time you're tempted to trust a detection, look at it first.
save_template is the switch that earns this node its warning label. It's off by default. When it's on, the node writes templates/<template_name>-N.json into project_dir - and because this node is an output node, it re-executes on every single queue rather than being cached. Leave the switch on while you iterate and you'll accumulate a template file per run. Set it, save once, turn it off. The README says this in as many words: after saving the template, close the save switch.
project_dir must be an existing folder on the machine running ComfyUI - the pack resolves it strictly and refuses to write outside it, with errors that say so ("请填写分镜项目目录" if blank, "分镜项目目录必须是文件夹" if it isn't a directory). Relative paths resolve against where ComfyUI was started.
Install
The usual for this pack: clone, install the separately-published core library, restart.
cd ComfyUI/custom_nodes
git clone https://github.com/cOkieeman/ComfyUI-Soda-Storyboard
cd ComfyUI-Soda-Storyboard && python -m pip install --upgrade soda-storyboard
Windows portable, from ComfyUI_windows_portable:
.\python_embeded\python.exe -m pip install -r .\ComfyUI\custom_nodes\ComfyUI-Soda-Storyboard\requirements.txt
Or Manager → search Soda Storyboard (comfyui-soda-storyboard). You don't need the MOSS model files to use this node - extraction is pure image processing - but you do need the core library, and nothing runs without it.
Honest limitations
You get layout, not meaning. Panel ids, reading order, and boxes come out; a description of what's happening in each panel does not. That's fine when you wanted the composition, annoying when you were hoping to bootleg a whole storyboard out of a jpeg.
The usual failure mode is a page with overlapping or borderless panels: it will find something plausible and slightly wrong. Correct it the way the author intends - as a template you then edit in the project, not as gospel. And if project_dir points at a folder that doesn't exist yet, the node raises rather than creating it for you, so make the directory first.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| direction | COMBO | 2 options: rtl, ltr | |
| save_template | BOOLEAN | false | — |
| project_diropt | STRING | — | |
| template_nameopt | STRING | Reference layout | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| layout_json | STRING | — |
| preview | IMAGE | — |