ComfyUI > Nodes > ComfyUI-YCNodes > 文本图像生成器

ComfyUI Node: 文本图像生成器

Class Name

YCTextImageGenerator

Category
YCNode/Text
Author
yichengup (Account age: 473days)
Extension
ComfyUI-YCNodes
Latest Updated
2025-06-03
Github Stars
0.02K

How to Install ComfyUI-YCNodes

Install this extension via the ComfyUI Manager by searching for ComfyUI-YCNodes
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-YCNodes 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

文本图像生成器 Description

Versatile node for creating customizable text-based images with various parameters and mask support.

文本图像生成器:

The YCTextImageGenerator is a versatile node designed to create text-based images with customizable features, making it an essential tool for AI artists who want to integrate text into their visual projects. This node allows you to generate images with text by specifying various parameters such as canvas size, font style, text alignment, and color options. It provides the flexibility to adjust the orientation and positioning of the text, ensuring that the final output aligns with your creative vision. The node also supports the creation of a corresponding mask, which can be used for further image processing or effects. By offering a wide range of customization options, the YCTextImageGenerator empowers you to produce high-quality text images that can be seamlessly integrated into your artistic workflows.

文本图像生成器 Input Parameters:

canvas_width

The canvas_width parameter defines the width of the canvas on which the text will be drawn. It allows you to specify the horizontal size of the image, with a default value of 512 pixels. The minimum and maximum values are 64 and 4096 pixels, respectively, and the width can be adjusted in increments of 8 pixels. This parameter is crucial for determining the overall size of the generated image and ensuring that the text fits appropriately within the canvas.

canvas_height

The canvas_height parameter sets the height of the canvas for the text image. Similar to canvas_width, it has a default value of 512 pixels, with a range from 64 to 4096 pixels and adjustable in steps of 8 pixels. This parameter controls the vertical dimension of the image, allowing you to accommodate text of varying lengths and orientations.

font_size

The font_size parameter specifies the size of the text font, with a default value of 72. It can be adjusted between 8 and 500, in increments of 1. This parameter directly affects the readability and visual impact of the text, enabling you to scale the font size to suit your design needs.

orientation

The orientation parameter determines the direction in which the text is laid out, offering options of "horizontal" or "vertical". The default setting is "horizontal". This parameter is essential for aligning the text with the intended design, whether it be for traditional horizontal reading or vertical arrangements.

alignment

The alignment parameter controls the horizontal alignment of the text within the canvas, with options including "left", "center", and "right". The default is "center". This setting is important for positioning the text in a way that complements the overall composition of the image.

vertical_alignment

The vertical_alignment parameter sets the vertical alignment of the text, with choices of "top", "middle", and "bottom". The default is "middle". This parameter helps in placing the text at the desired vertical position on the canvas, ensuring a balanced layout.

x_position

The x_position parameter allows you to specify the horizontal starting point of the text on the canvas. It has a default value of 0, with a range from -4096 to 4096, adjustable in steps of 1. This parameter provides precise control over the text's horizontal placement, enabling you to fine-tune its position.

y_position

The y_position parameter defines the vertical starting point of the text on the canvas. Like x_position, it defaults to 0 and ranges from -4096 to 4096, with a step size of 1. This parameter is crucial for adjusting the vertical placement of the text, allowing for detailed positioning.

background_color

The background_color parameter sets the color of the canvas background, with a default value of "#000000" (black). This parameter is important for creating contrast with the text color and enhancing the visual appeal of the image.

text_color

The text_color parameter specifies the color of the text, defaulting to "#ffffff" (white). This setting is vital for ensuring the text stands out against the background, contributing to the overall readability and aesthetic of the image.

background_alpha

The background_alpha parameter controls the transparency of the canvas background, with a default value of 1.0 (fully opaque). It ranges from 0.0 (fully transparent) to 1.0, adjustable in steps of 0.01. This parameter allows for the creation of images with varying levels of background visibility.

text_alpha

The text_alpha parameter sets the transparency of the text, with a default of 1.0. It ranges from 0.0 to 1.0, with a step size of 0.01. This parameter is useful for creating text with different levels of opacity, adding depth and interest to the image.

font

The font parameter allows you to choose the font style for the text. This parameter is crucial for defining the visual character of the text, enabling you to select a font that aligns with your artistic vision.

letter_spacing

The letter_spacing parameter adjusts the space between individual letters in the text, with a default value of 0.0. It ranges from -0.5 to 2.0, adjustable in steps of 0.01. This parameter is important for fine-tuning the text's appearance and ensuring optimal readability.

word_spacing

The word_spacing parameter controls the space between words, with a default value of 1.0. It ranges from 0.5 to 5.0, with a step size of 0.1. This setting is essential for adjusting the text's flow and ensuring a balanced layout.

line_spacing

The line_spacing parameter sets the space between lines of text, with a default of 1.2. It ranges from 0.5 to 3.0, adjustable in steps of 0.1. This parameter is crucial for managing the vertical spacing of multiline text, contributing to the overall readability and aesthetic of the image.

文本图像生成器 Output Parameters:

IMAGE

The IMAGE output parameter provides the generated text image as a tensor. This output is the primary result of the node, representing the visual content created based on the specified input parameters. It can be used directly in your projects or further processed for additional effects.

MASK

The MASK output parameter delivers a corresponding mask for the text image, also as a tensor. This mask highlights the areas of the image where the text is present, allowing for advanced image processing techniques such as blending, compositing, or applying selective effects.

文本图像生成器 Usage Tips:

  • Experiment with different font_size and font combinations to achieve the desired text style and readability in your images.
  • Utilize the background_alpha and text_alpha parameters to create images with varying levels of transparency, adding depth and interest to your designs.
  • Adjust letter_spacing, word_spacing, and line_spacing to fine-tune the text layout, ensuring optimal readability and aesthetic appeal.

文本图像生成器 Common Errors and Solutions:

"Invalid canvas size"

  • Explanation: This error occurs when the specified canvas_width or canvas_height is outside the allowed range.
  • Solution: Ensure that both canvas_width and canvas_height are within the range of 64 to 4096 pixels.

"Font not found"

  • Explanation: This error indicates that the specified font is not available or incorrectly specified.
  • Solution: Verify that the font name is correct and that the font is installed on your system.

"Invalid color format"

  • Explanation: This error arises when the background_color or text_color is not in a valid hex format.
  • Solution: Ensure that color values are specified in the correct hex format, such as "#RRGGBB".

文本图像生成器 Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-YCNodes
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.