[SSN] Draw Text
Put text on images with real fonts, alignment, and a color picker
- image
- text_color
- font_name
- IMAGE
[SSN] Draw Text is the pack's headline image node: it takes an image, paints a line of text onto it, and hands the result back out. Watermarks, meme text, thumbnails with labels, burned-in titles on video frames - this is the node that does the thing every image-pipeline person eventually needs and usually has to hack together.
The inputs are the point, and most of them are self-explanatory: image (the IMAGE to draw on), text_content, text_pos_x / text_pos_y (top-left anchor by default), text_size, and text_color, which takes a COLOR - meaning it plugs straight into SsnInputColor's color picker, one of the nicer touches in this pack. Two inputs need explaining. font_name expects the FONT type, so you wire in SsnInputFont to pick from the pack's twelve bundled TTFs; leave it at "default" and you get PIL's tiny built-in bitmap font, which is fine for debugging and ugly for anything real. And text_align_horizontal / text_align_vertical (left/center/right, top/center/bottom) let you anchor the text relative to your text_pos point - set both to center and position 0,0 and your text lands dead-center on the image, which is the layout people actually want for titles.
Under the hood it's PIL's ImageDraw doing classic truetype rendering: your tensor is converted to a NumPy RGBA image, the text is drawn, and everything is converted back. It iterates the whole batch, so a batch of frames each get the text - that's how you burn a caption onto every frame of a video sequence. Alignment is computed from actual text metrics, and the color parsing handles both the RGB tuple from SsnInputColor and a raw hex string, so either wiring works.
Now the two gotchas that will bite. First, the output is always 4-channel RGBA, even if you fed in a plain 3-channel RGB image. Feed that straight into a node expecting RGB and you'll get a type mismatch or a transparent-looking result; run it through SsnPrepFlattenAlpha to composite it onto a solid background before it hits anything downstream. Second, the debug toggle is currently a no-op - it's in the signature but does nothing in the source, so don't flip it expecting behavior.
Install
Part of smn_support_nodes by SummonTheCat. ComfyUI Manager → search smn_support_nodes → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/SummonTheCat/smn_support_nodes
Restart required. Dependencies are opencv-python and imageio-ffmpeg (auto-installed); the fonts ship inside the pack, so no downloads.
Troubleshooting
The three things that actually go wrong: (1) RGBA output breaking an RGB-only downstream - flatten it first; (2) text rendering in a chunky pixel font because font_name was never wired and stayed "default"; (3) "Font file not found" errors when a font name is typed by hand instead of chosen from the list. If text renders but is cut off at the edge, remember position is the top-left anchor by default - for centered text set both alignments to center.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| text_content | STRING | Sample Text | — |
| text_pos_x | INT | 0 | — |
| text_pos_y | INT | 0 | — |
| text_size | INT | 12 | — |
| text_color | COLOR | #FFFFFF | — |
| font_name | FONT | — | |
| text_align_horizontal | COMBO | left | 3 options: left, center, right |
| text_align_vertical | COMBO | top | 3 options: top, center, bottom |
| debug | BOOLEAN | false | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |