ComfyUI  >  Nodes  >  KJNodes for ComfyUI >  Create Text Mask

ComfyUI Node: Create Text Mask

Class Name

CreateTextMask

Category
KJNodes/text
Author
kijai (Account age: 2192 days)
Extension
KJNodes for ComfyUI
Latest Updated
6/25/2024
Github Stars
0.3K

How to Install KJNodes for ComfyUI

Install this extension via the ComfyUI Manager by searching for  KJNodes for ComfyUI
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter KJNodes for ComfyUI in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Create Text Mask Description

Generate text masks for images with specified text, font, size, color, and alignment, supporting animations.

Create Text Mask:

The CreateTextMask node is designed to generate a mask or a batch of masks with specified text, allowing you to create visually appealing text overlays for your images. This node is particularly useful for adding text-based annotations, labels, or artistic text elements to your projects. By specifying the text, font, size, color, and alignment, you can customize the appearance of the text to fit your creative vision. The node also supports creating animations by varying the rotation of the text across frames, making it a versatile tool for dynamic text effects.

Create Text Mask Input Parameters:

coordinates

This parameter specifies the center locations for the text within the frame. It is a required string input that determines where the text will be placed.

text

This parameter allows you to input the text that will be used to create the mask. It is a required string input with a default value of 'text' and supports multiline text.

frame_width

This parameter sets the width of the frame in which the text will be placed. It is an integer input with a default value of 512, and it can range from a minimum of 16 to a maximum of 4096.

frame_height

This parameter sets the height of the frame in which the text will be placed. It is an integer input with a default value of 512, and it can range from a minimum of 16 to a maximum of 4096.

font

This parameter allows you to select the font for the text from a list of available fonts in the kjnodes_fonts folder. It is a required input.

font_size

This parameter sets the size of the font for the text. It is an integer input with a default value of 42.

alignment

This parameter determines the alignment of the text within the frame. It offers three options: 'left', 'center', and 'right', with a default value of 'center'.

text_color

This parameter sets the color of the text. It is a string input with a default value of 'white'.

size_multiplier

This optional parameter allows you to scale the size of the text. It is a float input with a default value of [1.0] and requires forced input.

Create Text Mask Output Parameters:

image

This output parameter provides the generated image with the text overlay. It is an image type output.

mask

This output parameter provides the mask created from the text. It is a mask type output.

mask_inverted

This output parameter provides the inverted version of the mask created from the text. It is a mask type output.

Create Text Mask Usage Tips:

  • To create a centered text overlay, ensure that the alignment parameter is set to 'center' and adjust the coordinates parameter to place the text in the desired location.
  • Use the size_multiplier parameter to scale the text size dynamically, which can be useful for creating responsive text overlays that adapt to different frame sizes.
  • Experiment with different fonts from the kjnodes_fonts folder to achieve various stylistic effects and enhance the visual appeal of your text overlays.

Create Text Mask Common Errors and Solutions:

"Invalid font selected"

  • Explanation: The selected font is not available in the kjnodes_fonts folder.
  • Solution: Ensure that the font you select is present in the kjnodes_fonts folder. You can add new fonts to this folder if needed.

"Text exceeds frame boundaries"

  • Explanation: The specified text size and coordinates cause the text to exceed the frame boundaries.
  • Solution: Adjust the font_size, coordinates, or frame_width and frame_height parameters to ensure the text fits within the frame.

"Invalid color format"

  • Explanation: The text_color parameter is not in a recognized color format.
  • Solution: Use standard color names (e.g., 'white', 'black') or hexadecimal color codes (e.g., '#FFFFFF') for the text_color parameter.

Create Text Mask Related Nodes

Go back to the extension to check out more related nodes.
KJNodes for ComfyUI
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.