XB-BOX - 📝 漫画提示词智能解析
Strip dialogue out of your comic prompt before the model sees it
- 洗净给大模型的提示词
- 给渲染节点的台词(|分隔)
The root cause of gibberish comic text isn't that image models can't draw letters - it's that you asked them to. Type "a speech bubble saying 真难看" into a prompt and the model dutifully tries to render the characters and produces noise. XB_ComicPromptParser is the upstream half of XB_ToolBox's comic text pipeline: it takes your script, pulls the dialogue out of [brackets], and makes sure the image model only ever sees "an empty white bubble" while the dialogue is handed to a separate text renderer. The model draws the art; the node writes the words.
It's a two-line text node, not a CV tool - but it's the one that prevents the whole problem. Without it, the automatic bubble renderer downstream is just whitewashing bad text the model drew.
How it works
You write your script in the raw_prompt field with dialogue marked in square brackets:
第一格大图,男生冷酷,[宋琛眉眼清秀,嘴里却叼着根突兀烟],左侧气泡,[真难看。]
The node runs two passes:
- Extracts every
[…]block into a dialogue list. - Replaces each bracket with a bubble description sized by the dialogue's character count - ≤3 chars becomes "一个微小紧凑的" (tiny), ≤8 "一个标准大小的" (standard), ≤18 "一个宽大的" (wide), more than that "一个占据极大面积的超大长条形" (extra-large strip). So the prompt the model actually sees says "a small empty bubble here, a wide one there," never the text itself.
This is the pack's "SSOT" (single source of truth) idea: your script is the one place the dialogue lives, and two outputs fan out from it.
The inputs that matter
- raw_prompt - the whole script with
[台词]markers. Multiline, so a full page fits. - base_bubble_desc - the base description of a bubble, default
纯白干净的空白对话框(pure white clean empty dialogue box). The node prepends the size adjective. If you want bubbles with tails, outlines, or a different shape, edit this.
Outputs are named exactly what they're for:
- 洗净给大模型的提示词 - the cleaned prompt (bubbles only, no text) to feed your CLIP encoder.
- 给渲染节点的台词(|分隔) - the extracted dialogue as
台词1 | 台词2 | 台词3, ready to plug into XB_AutoBubbleTextRenderer'stextfield.
Installing
Part of XB_ToolBox - ComfyUI Manager → XB_ToolBox, or
cd ComfyUI/custom_nodes
git clone https://github.com/WJLUOXIAO/XB_ToolBox.git
restart, done. Pure Python string handling, zero extra dependencies.
Common issues
- Bubbles end up wrong sizes - the size mapping is purely character-count based, so short English words ("Hi!") map to a "微小" bubble that may look tiny on a big panel. Adjust your script phrasing or accept the heuristic.
- A line of dialogue vanishes - an empty
[]is dropped entirely. Make sure every bracket has content. - Prompt still contains text - the parser only strips
[square brackets]. Text written outside brackets stays in the prompt and the model will still try to draw it.
It's a narrow but genuinely useful node: it encodes a hard-won lesson (never let the model render text) into something you can't forget to do. If you write comics with ComfyUI, this plus the auto renderer is the workflow.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| raw_prompt | STRING | 第一格大图,男生冷酷,[宋琛眉眼清秀,嘴里却叼着根突兀烟],左侧气泡,[真难看。] | 完整剧本。用方括号 [台词] 标记对白,节点会自动提取和清洗 |
| base_bubble_desc | STRING | 纯白干净的空白对话框 | 气泡基础描述。节点会根据字数自动追加微小/标准/宽大/超大等修饰词 |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| 洗净给大模型的提示词 | STRING | — |
| 给渲染节点的台词(|分隔) | STRING | — |