ComfyUI-KJNodes
Run ComfyUI Easily with InstaSD
Skip the complex setup. InstaSD helps creative professionals build workflows and deploy them to the world:
- One-click deployment
- Any model, any node
- Powerful GPUs for rapid iteration
Available Nodes
CreateTextMask
Create Text Mask Node Documentation
Overview
The Create Text Mask node is part of the KJNodes collection designed to enhance the ComfyUI experience with various utility and masking-related nodes. This specific node generates a text-based image and its corresponding mask, which can be used as part of image processing workflows within ComfyUI. This can be useful for visual effects, artistic text overlays, or dynamic animations.
Functionality
The Create Text Mask node creates a text image and its respective mask in a specified dimension. It utilizes configurable options to specify factors like text placement, font, color, and potential animation effects through rotation.
Inputs
The Create Text Mask Node accepts the following inputs:
- invert: A boolean flag (
TrueorFalse) to determine if the output image and mask should be inverted. - frames: An integer representing the number of frames to generate. Use this to produce animations or batches.
- text_x: The horizontal position (in pixels) for the starting point of the text.
- text_y: The vertical position (in pixels) for the starting point of the text.
- font_size: The size of the font to use for rendering text.
- font_color: The color to use for the text. Can be specified in standard color names or hex codes.
- text: The string of text to render. Supports multiline text.
- font: The specific font file to use. This should be located in the
ComfyUI/custom_nodes/ComfyUI-KJNodes/fontsdirectory. - width: The width of the resulting image and mask.
- height: The height of the resulting image and mask.
- start_rotation: The initial rotation angle for the text.
- end_rotation: The final rotation angle if creating an animation. The text is animated between the start and end rotations over the specified number of frames.
Outputs
The node produces two primary outputs:
- Image: A torch tensor representation of the image containing the text.
- Mask: A mask representing the area where the text appears. If
invertis set toTrue, this will be the inverted mask.
Use in ComfyUI Workflows
The Create Text Mask node is versatile in ComfyUI workflows, particularly for:
- Creating overlays where text needs to be dynamically placed over images or video frames.
- Utilizing the mask to apply effects only to regions where text exists, enhancing post-processing capabilities.
- Generating animated text sequences, which are valuable in video production workflows or creating dynamic GIFs.
- Facilitating artistic projects where custom fonts and layouts are crucial.
Special Features and Considerations
- Animation Support: The node can generate sequences of frames with gradually changing text rotation, thanks to the flexibility of the
start_rotationandend_rotationinputs. - Font Management: The node retrieves fonts from a specific directory (
ComfyUI/custom_nodes/ComfyUI-KJNodes/fonts), so users can extend their font library simply by adding font files to this directory. - Inverse Operation: By setting the
invertparameter, users can directly produce inverted masks or images, useful for certain artistic or processing techniques. - Batch Processing: The
framesinput allows the node to produce a batch of images, which can be processed together for efficiency.
The Create Text Mask node is a powerful tool for creators looking to combine text with image manipulation, offering both straightforward text rendering and advanced animations within ComfyUI.