Nodes/RyanOnTheInside/Text Mask Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
ComfyUI Node

Text Mask Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜

Render text straight into a mask, no external image editor needed

By ryanontheinsideΒ·Created 2 years agoΒ·Updated 5 months agoΒ· 852
Text Mask Node βš‘πŸ…‘πŸ…žπŸ…£πŸ…˜
    • MASK
    • IMAGE
    β—„width512β–Ί
    β—„height512β–Ί
    β—„textHello Worldβ–Ί
    β—„fontβ–Ύβ–Ί
    β—„font_size32β–Ί
    β—„font_color(255,255,255)β–Ί
    β—„background_color(0,0,0)β–Ί
    β—„x_position0.50β–Ί
    β—„y_position0.50β–Ί
    β—„rotation0.00β–Ί
    β—„max_width_ratio0.90β–Ί
    β—„batch_size1β–Ί

    If you need a mask shaped like text - for compositing lettering into a frame, inpainting a title region, or building a stylized-typography effect - this node renders it directly instead of you round-tripping through Photoshop or GIMP to make one. It's a plain Pillow-based text renderer under the hood, outputting both the mask itself and a preview image so you can see what you're getting.

    Inputs and outputs that matter

    The core ones: text (default "Hello World"), width/height (canvas size, 1-8192 px), font_size (1-1000), and font - a dropdown of whatever fonts are installed on the machine actually rendering the node (this pack ships an enum with dozens of system fonts, DejaVu Sans and friends among them). Position and shape controls: x_position/y_position (0.0-1.0, normalized placement within the frame), rotation (0-360Β°), and max_width_ratio (0.1-1.0, caps how wide the text can get relative to the frame before it wraps or shrinks). Color is set via font_color and background_color, both plain RGB strings like (255,255,255). batch_size (1-10000) repeats the identical static mask across a batch - it does not animate the text moving or appearing; every frame in that batch gets the same mask.

    Outputs: MASK and IMAGE.

    Worth knowing if you're running this on a shared or cloud instance

    The font list is populated from whatever's actually installed on the machine rendering the workflow - locally that might be a huge list including fonts you've personally installed; on a shared/cloud runtime it's whatever fonts ship with that image. A workflow saved with one font name might silently fall back or fail to find that exact font on a different machine. If you're sharing a workflow across environments, don't assume a specific display font you picked locally is guaranteed to be present elsewhere - stick to common system fonts (DejaVu Sans and similar) for anything you expect to run reliably in more than one place.

    Installing it

    ComfyUI Manager: search RyanOnTheInside, install, restart. Manual:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ryanontheinside/ComfyUI_RyanOnTheInside
    cd ComfyUI_RyanOnTheInside
    pip install -r requirements.txt
    

    pillow is already in this pack's requirements.txt, which is what handles the text rendering - a standard install covers it.

    Where people get burned

    The font dropdown is long (over 80 entries) and includes multiple weight/style variants of the same family name, which makes it easy to pick the wrong variant by accident - double-check the rendered preview IMAGE output rather than trusting the name alone. And remember batch_size is a repeat count, not an animation control: if you're expecting text that appears letter-by-letter or moves across frames, you won't get that from this node by itself - you'd need to drive position or a reveal mask per-frame some other way, this node just stamps out N identical copies of one static text render.

    CategoryRyanOnTheInside/Masks

    Inputs (12)

    NameTypeDefaultDescription
    widthINT5121–8192Width of the output image in pixels (1 to 8192)
    heightINT5121–8192Height of the output image in pixels (1 to 8192)
    textSTRINGHello WorldText content to render
    fontCOMBOFont family to use for rendering (from system fonts)
    font_sizeINT321–1000Size of the font in pixels (1 to 1000)
    font_colorSTRING(255,255,255)Color of the text in RGB format (e.g., '(255,255,255)')
    background_colorSTRING(0,0,0)Color of the background in RGB format (e.g., '(0,0,0)')
    x_positionFLOAT0.500–1Horizontal position of text relative to frame width (0.0 to 1.0)
    y_positionFLOAT0.500–1Vertical position of text relative to frame height (0.0 to 1.0)
    rotationFLOAT0.000–360Rotation angle of the text in degrees (0 to 360)
    max_width_ratioFLOAT0.900.1–1Maximum text width as ratio of frame width (0.1 to 1.0)
    batch_sizeINT11–10000Number of identical text masks to generate (1 to 10000)

    Outputs (2)

    NameTypeDescription
    MASKMASKβ€”
    IMAGEIMAGEβ€”