Nodes/noEmbryo nodes/Image From String /noEmbryo
ComfyUI Node

Image From String /noEmbryo

Type the text, don't generate it

By noembryo·Created 3 years ago·Updated a day ago· 46
Image From String /noEmbryo
    • image
    • mask
    ◄textHello World►
    ◄font_namedefault►
    ◄font_size32►
    ◄font_color#FFFFFF►
    ◄outline_size0►
    ◄alignmentleft►

    Text is the thing diffusion is worst at. You can prompt "a wooden sign that says OPEN" forty times and get forty variations of "OPEM" in a font that doesn't exist. So for anything where the words actually have to be readable - a title card, a watermark, a caption strip on a contact sheet, a signature scribbled in the corner - you don't generate them. You draw them.

    That's this node. Plain PIL draw.text onto a transparent canvas. Deterministic, instant, correct spelling, no seed, no model. Text overlay sits in the same bucket as film grain and colour curves: an old, settled operation that was never worth a diffusion pass. Historically it lived inside WAS Node Suite, which has been dormant since 2023 - small packs like this one are what people pick up instead.

    What comes out of it

    An IMAGE and a MASK. The image is RGBA with a fully transparent background, and its canvas is sized to the text: width from the widest line plus padding for the outline, height from the summed line heights plus the font's line spacing. Nothing is canned at 512×512. If your text is three short lines at 48px you get something like 420×160, and the transparency is real - save it as PNG and it stays transparent.

    The mask is 1 - alpha. Note that direction, because it bites: white is the background, black is the glyphs. That's backwards from what you want when the text itself is the thing to be masked, so add core's Invert Mask before feeding it anywhere that expects the subject to be 1.

    The knobs you'll actually turn

    text is multiline, so you can paste a paragraph and get wrapped-by-you lines, not wrapped-by-the-node lines - no auto-wrap, your newlines are the only breaks. font_size is in pixels (1–1024). alignment (left, center, right) positions each line within the block width, which only matters once your lines differ in length. font_color takes #FFF or #FFFFFF hex; anything it can't parse silently becomes white. outline_size (0–128) adds a stroke around the glyphs, and the stroke colour is the inverse of your font colour - white text gets a black outline, black text gets a white one. That's deliberate: it's a legibility outline for putting text over busy photos, not a design tool. You can't pick the outline colour, and if you need to, this isn't the node.

    font_name is a dropdown of whatever fonts it found on your machine - and this is where the pack is most likely to annoy you.

    The font gotcha, and how to fix it

    The font scan is not recursive. On Windows it reads C:\Windows\Fonts and works fine. On Linux it looks in /usr/share/fonts, /usr/local/share/fonts and ~/.fonts - but only at files sitting directly in those folders, and on a normal Linux install every font is one level deeper in /usr/share/fonts/truetype/dejavu/. On macOS it never looks at /System/Library/Fonts at all. Result: the dropdown offers a single entry called default.

    And default isn't a font, it's PIL's built-in bitmap fallback, which renders small and ignores your font_size entirely.

    The fix on Linux or macOS is to put the actual font files where the node can see them, flat:

    mkdir -p ~/.fonts
    cp /usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf ~/.fonts/
    

    Then restart ComfyUI, not just the browser tab. The font list is cached in the class for the lifetime of the process, so a page refresh will keep showing you the old dropdown.

    Install

    Manager → search "noEmbryo nodes", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/noembryo/ComfyUI-noEmbryo.git
    

    Restart. It's under Add Node → noEmbryo → Image. The repo has no requirements file and the package declares zero dependencies - it's PIL, numpy and torch, all of which a ComfyUI install already has. No models to download. The pack is a one-man hobby collection (the author posts his own releases on r/comfyui), so this text node ships alongside a load-from-any-path loader, an interactive crop, an image composer and a large pile of MiniMax H3 clip tools. Installing it for one node is cheap, at least.

    Using it without swearing

    The canvas is content-sized and odd - 437×93, that kind of thing. That's fine for compositing but not for encoding: a VAE downsamples by 8, so if you're pushing this through VAE Encode, resize or pad to multiples of 8 first or your framing drifts by a few pixels. It also keeps four channels, and most downstream nodes expect three; core's VAE Encode takes the first three and drops the alpha, usually what you want.

    The genuinely useful pairing is inside the same pack: Image Composer packs several images into one sheet at natural size, so Load Image → Image Composer plus Image From String for each caption gets you a labelled contact sheet with no compositing math. For a real overlay, invert the mask and composite the text onto your frame - pixel-exact, which is more than any prompt will give you.

    CategorynoEmbryo/Image

    Inputs (6)

    NameTypeDefaultDescription
    textSTRINGHello WorldText to render into an image.
    font_nameCOMBOdefaultFont to use for rendering.
    font_sizeINT321–1024Font size in pixels.
    font_colorSTRING#FFFFFFFont color as a hex value (e.g. #FFFFFF or #FFF).
    outline_sizeINT00–128Outline thickness in pixels (0 = no outline). Outline color is the inverted font color.
    alignmentCOMBOleftHorizontal text alignment.

    Outputs (2)

    NameTypeDescription
    imageIMAGE—
    maskMASK—