A node for ComfyUI that allows you to overlay text on an image in an area defined by a mask, with support for text rotation, custom fonts, line breaks and transparency.
ComfyUI_RaykoStudio — a set of custom nodes for ComfyUI providing additional image processing capabilities
RS_RusTextOverlay
allows you to overlay text on an image in the area specified by the mask. The node supports text rotation depending on the mask angle, automatic font size adjustment, custom fonts, line breaks and text transparency settings, line spacing and letter spacing adjustment, text color and fill gradient selection.
.ttf
or . otf
) downloaded from fonts
folderimage
: Image (RGB tensor)mask
: Mask (L tensor) defining the text areaIMAGE
: Image with overlaid text (RGB tensor)text
: Text to overlay (supports line breaks)font_name
: Select font from available in fonts
folder (or use default
)text_color
: Text color (HEX format, e.g. #FFFFFF
)use_gradient
: Use gradient text fillingdirectiont
: Gradient directionstart_color
: Start gradient colorend_color
: Finish gradient coloroutline_thickness
: Border Thicknessoutline_color
: Color of strokerotate_with_mask
: Enable/disable text rotation according to mask's tilt angletext_opacity
: Text transparency (0-100%, where 0 - fully transparent, 100 - fully opaque)min_font_size
: Minimum font size (if text doesn't fit, default font is used)padding
: Padding around text within maskvertical_align
: Vertical text alignment (top/center/bottom)horizontal_align
: Horizontal text alignment (left/center/right)line_spacing
: Adjusts the line spacing from 0.5 to 3.0letter_spacing
: Adjusts the letter spacing from -5.0 to 20.0ComfyUI/custom_nodes/
folder:git clone https://github.com/Raykosan/ComfyUI_RaykoStudio.git
pip install -r requirements.txt
Required libraries (specified in requirements.txt):
torch>=1.7.0
numpy>=1.19.0
Pillow>=8.0.0
opencv-python>=4.5.0
math
After installation find node in ComfyUI under name 🦊 RS_RusTextOverlay (category: 🦊 RaykoStudio/Image).
Connect inputs (image and mask) and adjust parameters.
Example workflow can be found in examples folder:
example workflow.json: example ComfyUI workflow
example.png: Result screenshot
Vertical and diagonal gradients do not work properly
If you encounter an issue or find a bug:
Check Issues section on GitHub, maybe problem is already known.
If new problem, create new Issue describing:
MIT License. Use node at your own risk without any warranties.
Thanks to ComfyUI community for inspiration and support! If you like this node, don't forget to star on GitHub!