ComfyUI Node Runs on cloud

StringToImage

Render a caption you can burn into your output grid

By ali1234·Created 3 years ago·Updated 3 months ago· 130
StringToImage
  • colour
  • background
  • image
textHello world!
width384
height16

Run a big sweep with comfyui-job-iterator and you'll end up with a folder full of images that all look similar but were generated with different settings. Without labels, figuring out which was which after the fact is a guessing game. StringToImage exists to solve exactly that: it renders plain text to a small image, so you can stamp the seed, the prompt fragment, or the current step's attributes right onto (or next to) the output itself.

How it works

It's a small PIL routine - draw a solid background, center your text on it with PIL's built-in default font, and hand back a normalized image tensor the same way ProgressBar does. There's no custom font support and no text wrapping; what you get is exactly what PIL's default font renders at whatever canvas size you gave it.

The inputs and outputs that matter

  • text (STRING, default "Hello world!") - the caption to render.
  • width / height (INT, default 384×16) - canvas size in pixels. The defaults make a thin caption strip, not a poster - bump height if your text needs more room.
  • colour / background (COLOR) - text color and backdrop.

Output is a single image, meant to feed into JoinImages or Join Image Batch so the caption ends up attached to your actual output rather than floating separately.

The natural pairing in this pack is FormatAttributes into StringToImage: use FormatAttributes to turn a step's attributes into a readable string ("seed={seed}, cfg={cfg}"), then feed that string straight into text here. That's the whole reason both nodes exist in the same pack.

How to install it

Via ComfyUI Manager: search comfyui-job-iterator, install, restart. Manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ali1234/comfyui-job-iterator

then restart. No dependencies - Pillow ships with a normal ComfyUI install already.

Common issues & troubleshooting

Long captions run off the edge. There's no text wrapping here - if your string is wider than the canvas, PIL just centers the (now overflowing) text and lets it clip past the edges instead of shrinking or wrapping it. Either keep captions short, widen the canvas, or truncate the string upstream before it hits this node.

Text looks tiny and can't be made bigger. You're stuck with PIL's default bitmap font - there's no font-size or custom-font input on this node. If you need larger, more legible text, your only lever is scaling the whole output image up afterward with a resize node, which will scale the (still blurry) text along with everything else.

Color name doesn't render as expected. colour/background accept the usual PIL color names and hex strings - if something looks off, try a plain hex value (#ffffff) instead of a named color to rule out a typo in the name.

Categoryali1234/image

Inputs (5)

NameTypeDefaultDescription
textSTRINGHello world!
widthINT384
heightINT16
colourCOLORwhite
backgroundCOLORblack

Outputs (1)

NameTypeDescription
imageIMAGE