ComfyUI Node

ImageText

Render text to a transparent image without leaving ComfyUI

By Nourepide·Created 3 years ago·Updated 2 years ago· 296
ImageText
    • IMAGE
    text
    font
    size28
    red255
    green255
    blue255
    alpha1.00
    margin_x0
    margin_y0

    Need a watermark, a label, a caption, or any text turned into an image inside your workflow? That's this node. Allor's ImageText renders a line of text onto a transparent RGBA canvas that's sized to the text itself, and hands you back an IMAGE you can composite anywhere. It's the "text → image" primitive you didn't know you were missing - no external image editor, no font-in-the-prompt guessing, just type a string, pick a font, get pixels.

    It's part of the Allor Plugin (Nourepide/ComfyUI-Allor), and like everything in the pack it keeps the alpha channel, which is the whole trick here: the output is a transparent layer, so you can drop it over a generated image for a clean watermark or burn it in for subtitles.

    How it works

    Under the hood it's PIL drawing: it loads the font you picked, measures the text's bounding box, creates a canvas just big enough to hold it (plus your margin_x/margin_y padding), and draws the string in the fill color you set. Interesting implementation detail: ImageText is actually a thin wrapper that calls the pack's ImageTextOutlined with outline_size set to 0 - so the plumbing is shared, and this node is just the no-outline flavor.

    The font comes from the pack's fonts folder, which Allor defaults to ComfyUI/comfy_extras/fonts (it registers that path, and you can enable system and user font folders via config.json). No font installed means an empty dropdown - that's the single most common "why is this broken" moment, and it's not a bug, it's a missing .ttf/.otf.

    Inputs and outputs

    • text (STRING, single line) - what you want rendered.
    • font - dropdown of fonts in the fonts folder.
    • size (INT, default 28) - font size in points.
    • red/green/blue (INT, default 255 each) - fill color, white by default.
    • alpha (FLOAT, default 1.0) - opacity. 0.5 is a classic watermark setting.
    • margin_x/margin_y (INT, default 0) - extra padding around the text.

    Output is a single RGBA IMAGE, sized to the text. Because it's only as big as the text, you'll want to composite it over your target image - the pack's composite nodes (or core Blend/Composite) are the usual next step.

    Installing it

    Search "Allor Plugin" in ComfyUI Manager, install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Nourepide/ComfyUI-Allor
    

    Then drop a font in:

    mkdir -p ComfyUI/comfy_extras/fonts
    # copy a .ttf or .otf in, e.g. OverlockSC-Regular.ttf
    

    Restart or reload and the font appears in the dropdown. The pack's own demo logo uses fonts like Overlock SC and Merienda this way.

    Where people get burned

    Empty font dropdown is #1 - the folder exists but nothing's in it. #2 is expecting the output to be image-sized: it's not, it's text-sized, so feed it into a composite rather than a direct save. #3: this is single-line only. The moment your text has a newline or you want it centered, use the multiline siblings (ImageTextMultiline, or the Outlined variants) instead. And remember alpha is a 0–1 float while colors are 0–255 ints - a common finger-slip is typing 255 into alpha and getting an opaque block.

    Categoryimage/draw

    Inputs (9)

    NameTypeDefaultDescription
    textSTRING
    fontCOMBO0 options:
    sizeINT28
    redINT255
    greenINT255
    blueINT255
    alphaFLOAT1.00
    margin_xINT0
    margin_yINT0

    Outputs (1)

    NameTypeDescription
    IMAGEIMAGE