XB-BOX - 💬 漫画文字渲染 (精确坐标)
Place comic text at exact coordinates — narration, SFX, anything
- image
- 图像
The auto bubble renderer handles the common case, but comics have text that doesn't live in bubbles: narration boxes, sound effects, a caption across the bottom, a tiny label next to a character's head. XB_ComicTextRenderer is the precise manual tool for all of that - you give it an X/Y coordinate and it typesets text there, pixel-exact, with optional outline. It's the fallback the pack itself calls "第一代物理光栅化节点," and it's the one you reach for when you need a word in a specific spot and no CV magic required.
Think of it as the sledgehammer-to-scalpel pairing: XB_AutoBubbleTextRenderer finds bubbles for you, this one just does what you tell it. They complement each other, and in a real comic workflow you'll probably use both.
How it works
Nothing clever under the hood, and that's the appeal. It's a PIL rasterizer: load your image, draw the text at (x, y) with the chosen font, and write the result back as an IMAGE tensor. The details that make it useful:
- Auto line wrapping -
max_width(px) is the max line width before it wraps;0means no limit. - Alignment -
left,center, orrightwithin thatmax_widthbox, not across the whole image. - Outline -
outline_width(0–10) draws the classic white-stroke-around-black-letter comic style usingoutline_color. - Multi-line -
\nin the text field makes new lines; line height is computed from the font metrics.
One honest limitation the source notes: each node call renders one text block at one position. Multiple captions means chaining several of these nodes (each one passes the image through), or you layer them - which is exactly what the node's own description recommends.
The inputs that matter
- image - the IMAGE to draw on.
- text - multiline,
\nsupported. - x / y - the top-left starting coordinates of the text block.
- max_width - wrap width in px,
0= no wrap. - alignment -
centeris default; with wrapping on, this is how each line aligns. - font_name / font_size / text_color -
msyh.ttc/simhei.ttfare typical; system fonts. - outline_width / outline_color - outline stroke width and color;
0for none.
Output: 图像 - the image with your text baked in.
Installing
Comes with XB_ToolBox (ComfyUI Manager → search XB_ToolBox, or git clone https://github.com/WJLUOXIAO/XB_ToolBox.git into custom_nodes), restart. Needs a font with CJK coverage for Chinese text - on Linux that often means installing fonts-noto-cjk, since msyh.ttc is Windows-only.
Common issues
- Boxes/tofu instead of characters - no CJK font installed. Point
font_nameat a real font path (e.g./usr/share/fonts/.../NotoSansCJK-Regular.ttc) or install one. - Text runs off the page -
max_widthtoo big or0, and a long line doesn't wrap. Set a sensible wrap width. - Outline looks chunky - the outline is a naive multi-offset redraw, so thin fonts with a wide outline (5+) get mushy. Keep
outline_widthlow.
It's not the flashy node in the comic family, but narration and SFX are half the craft of a page, and "I typed the coordinates and it was exactly there" is worth more than it sounds.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| text | STRING | 要渲染的文字。支持 \n 换行 | |
| font_name | STRING | msyh.ttc | 字体名或路径,如 msyh.ttc / simhei.ttf |
| font_size | INT | 368–500 | — |
| x | INT | 1000–8192 | 文字起始 X 坐标 |
| y | INT | 1000–8192 | 文字起始 Y 坐标 |
| max_width | INT | 4000–8192 | 最大宽度(px),超宽自动换行;0=不限制 |
| alignment | COMBO | center | 3 options: left, center, right |
| text_color | STRING | #000000 | — |
| outline_width | INT | 00–10 | — |
| outline_color | STRING | #FFFFFF | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| 图像 | IMAGE | — |