Comic Script Loader
The front door that keeps your LLM's JSON honest
- comic_script
- summary
The pack's whole bet is "write a screenplay, let an LLM turn it into a structured comic script, render it." Comic Script Loader is the front door of that bet - the node that takes the JSON, checks it's actually valid, and hands the pipeline a clean script object. It's the first node in the standard workflow: Loader → (optional Sampler Override) → Batch Generator → Page Composer. Skip it and there's no story to render.
Where the JSON comes from
The workflow starts outside ComfyUI. You write a screenplay in Markdown, give it to an LLM along with the pack's skill pack (docs/skills/comic-script-authoring/ - a SKILL.md for Claude Code, or PROMPT_TEMPLATE.md for any other model), and the AI acts as a "manga panel composition expert," producing a JSON script. The loader then runs two layers of validation: Layer 1 checks the JSON against the schema (strict - unknown keys are rejected outright), and Layer 2 checks semantics: page/panel index continuity, whether panels fit their page, dimensional consistency. A script that passes both is normalized into the COMIC_SCRIPT object the other nodes consume.
Loading modes - pick one
The mode widget has four values, and auto just uses whichever input field below it is filled:
- file -
json_fileis a relative path inside the ComfyUI input directory. The README's setup puts your script atComfyUI/input/comics/your_script.json. In the source this becomes a picker dropdown when your input dir contains JSON files. - path -
json_pathtakes an absolute path, and surrounding quotes are stripped automatically, so Windows' "Copy as Path" output just works. - inline -
json_textis a multiline field where you paste the JSON directly. Great for quick experiments with small scripts.
One genuinely annoying gotcha: auto errors out if you've filled more than one field. Paste inline JSON and leave a path in the box? Clear the one you don't want. The file mode also refuses paths that escape the input directory - a decent guard, but it means arbitrary JSON elsewhere on disk requires path mode.
What comes out
Two outputs: comic_script (the COMIC_SCRIPT object - wire it into ComicBatchGenerator) and summary, a plain-text STRING with the job id, page/panel counts, and reading direction. Read the summary before you queue a 60-panel batch; it's a free sanity check that the LLM actually produced what you asked for.
What's in the script, briefly
The schema is strict but small: a job_id, reading_direction (ltr or rtl), a page_template (A4, B5, JP_Tankobon, Webtoon, custom), page dimensions, a base_seed, global style_prompt and character_prompt pairs, a default_sampler (this is where steps/cfg/sampler live - not on the generator), and a pages[] array. Each page has a page_prompt, a layout_mode (only vertical_stack in this M1 release), and panels[] with scene_prompt, width/height, alignment, and shape. Prompts compose in four layers - style, character, page, scene - so you keep the character description in one place and every panel inherits it.
Install
Same as the other three nodes in this pack:
cd ComfyUI/custom_nodes
git clone https://github.com/tackcrypto1031/tk_comfyui_comic_tool.git
cd tk_comfyui_comic_tool
pip install Pillow jsonschema numpy
Or install via ComfyUI Manager by searching the pack title "tk_comfyui_batch_image", then restart. The node appears under comic/io. No model downloads, no heavy dependencies - Pillow, jsonschema, numpy, all almost certainly already present.
Troubleshooting
- "JSON parse error at line X, col Y" - the loader reports the exact spot, so it's usually a trailing comma or a stray quote from the LLM. This is the most common failure by far.
- Validation errors about unknown properties - the schema sets
additionalProperties: false, so any key the AI invented gets rejected. Tell it to stick to the schema. - Don't want to fight this in the UI? The pack ships a standalone validator CLI that runs outside ComfyUI - perfect for having the LLM self-check before the JSON ever touches a GPU:
python -m tk_comfyui_batch_image.validate my_script.json
That's the intended loop: LLM writes JSON, LLM (or you) validates it with the CLI, and only a known-good script ever reaches the batch generator. Small thing, but it's why this pack feels more engineered than most early-stage custom nodes.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | auto | auto = use whichever field below is filled. |
| json_fileopt | STRING | Relative path inside ComfyUI input dir; used when mode=file. | |
| json_pathopt | STRING | Absolute / relative path to JSON (surrounding quotes are stripped); used when mode=path. | |
| json_textopt | STRING | Inline JSON text; used when mode=inline. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| comic_script | COMIC_SCRIPT | — |
| summary | STRING | — |