Nodes/XB_ToolBox/XB-BOX - 💬 漫画文字渲染 (精确坐标)
ComfyUI Node

XB-BOX - 💬 漫画文字渲染 (精确坐标)

Place comic text at exact coordinates — narration, SFX, anything

By wjluoxiao·Created 5 months ago·Updated 6 days ago· 302
XB-BOX - 💬 漫画文字渲染 (精确坐标)
  • image
  • 图像
text
font_namemsyh.ttc
font_size36
x100
y100
max_width400
alignmentcenter
text_color#000000
outline_width0
outline_color#FFFFFF

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; 0 means no limit.
  • Alignment - left, center, or right within that max_width box, not across the whole image.
  • Outline - outline_width (0–10) draws the classic white-stroke-around-black-letter comic style using outline_color.
  • Multi-line - \n in 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, \n supported.
  • x / y - the top-left starting coordinates of the text block.
  • max_width - wrap width in px, 0 = no wrap.
  • alignment - center is default; with wrapping on, this is how each line aligns.
  • font_name / font_size / text_color - msyh.ttc/simhei.ttf are typical; system fonts.
  • outline_width / outline_color - outline stroke width and color; 0 for 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_name at a real font path (e.g. /usr/share/fonts/.../NotoSansCJK-Regular.ttc) or install one.
  • Text runs off the page - max_width too big or 0, 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_width low.

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.

CategoryXB_ToolBox/Comic

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
textSTRING要渲染的文字。支持 \n 换行
font_nameSTRINGmsyh.ttc字体名或路径,如 msyh.ttc / simhei.ttf
font_sizeINT368–500
xINT1000–8192文字起始 X 坐标
yINT1000–8192文字起始 Y 坐标
max_widthINT4000–8192最大宽度(px),超宽自动换行;0=不限制
alignmentCOMBOcenter3 options: left, center, right
text_colorSTRING#000000
outline_widthINT00–10
outline_colorSTRING#FFFFFF

Outputs (1)

NameTypeDescription
图像IMAGE