ComfyUI > Nodes > ComfyUI Essentials > 🔧 Draw Text

ComfyUI Node: 🔧 Draw Text

Class Name

DrawText+

Category
essentials/text
Author
cubiq (Account age: 5020days)
Extension
ComfyUI Essentials
Latest Updated
2024-07-01
Github Stars
0.35K

How to Install ComfyUI Essentials

Install this extension via the ComfyUI Manager by searching for ComfyUI Essentials
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI Essentials 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

🔧 Draw Text Description

Overlay customizable text on images for enhanced visual impact.

🔧 Draw Text+:

The DrawText+ node is designed to allow you to overlay text onto images with a high degree of customization. This node is particularly useful for adding annotations, captions, or any textual information directly onto your visual content. It provides a range of options to control the appearance and positioning of the text, including font type, size, color, alignment, and shadow effects. By leveraging these capabilities, you can create visually appealing and contextually relevant text overlays that enhance the overall impact of your images. Whether you are creating digital art, designing graphics, or simply adding labels to your photos, DrawText+ offers the flexibility and control needed to achieve professional results.

🔧 Draw Text+ Input Parameters:

text

This parameter specifies the text that you want to overlay on the image. It can include multiple lines separated by newline characters. The content of this text will be rendered onto the image based on the other styling and positioning parameters.

font

This parameter determines the font type used for the text. You can specify the path to a TrueType font file (.ttf) to customize the appearance of the text. The choice of font can significantly impact the readability and aesthetic of the text overlay.

size

This parameter sets the size of the font in points. It controls how large or small the text appears on the image. Adjusting the font size can help ensure that the text is appropriately scaled for the image dimensions and the intended use.

color

This parameter defines the color of the text. It accepts color names or hexadecimal color codes (e.g., #FFFFFF for white). The text color should be chosen to contrast well with the background for better visibility.

background_color

This parameter sets the background color of the text area. It can be specified using color names or hexadecimal color codes. The background color can help make the text stand out, especially if the underlying image is complex or colorful.

shadow_distance

This parameter specifies the distance of the shadow from the text. A non-zero value will create a shadow effect, adding depth and making the text more legible against various backgrounds. The distance is measured in pixels.

shadow_blur

This parameter controls the blur radius of the shadow. A higher value results in a softer, more diffused shadow, while a lower value creates a sharper shadow. This can enhance the visual appeal and readability of the text.

shadow_color

This parameter sets the color of the shadow. It accepts color names or hexadecimal color codes. The shadow color should be chosen to complement the text color and background for a cohesive look.

horizontal_align

This parameter determines the horizontal alignment of the text within the image. Options include "left", "center", and "right". Proper alignment ensures that the text is positioned correctly relative to the image's width.

vertical_align

This parameter specifies the vertical alignment of the text within the image. Options include "top", "center", and "bottom". Vertical alignment helps position the text appropriately relative to the image's height.

offset_x

This parameter sets the horizontal offset of the text from its aligned position. It allows fine-tuning of the text's horizontal placement, measured in pixels.

offset_y

This parameter sets the vertical offset of the text from its aligned position. It allows fine-tuning of the text's vertical placement, measured in pixels.

img_composite

This optional parameter allows you to provide an existing image onto which the text will be overlaid. If not provided, a new image will be created based on the text dimensions and background color.

🔧 Draw Text+ Output Parameters:

mask

The output parameter mask is a tensor representing the image with the overlaid text. This tensor can be used in further image processing pipelines or saved as an image file. The mask includes the alpha channel, which represents the transparency of the text and background.

🔧 Draw Text+ Usage Tips:

  • To ensure the text is readable, choose a font color that contrasts well with the background color or image.
  • Use the shadow effect to add depth and improve text legibility, especially on complex backgrounds.
  • Experiment with different font sizes and types to find the best fit for your image and message.
  • Utilize the alignment and offset parameters to position the text precisely where you want it on the image.

🔧 Draw Text+ Common Errors and Solutions:

"Font file not found"

  • Explanation: The specified font file path is incorrect or the file does not exist.
  • Solution: Verify the font file path and ensure the file is located in the specified directory.

"Invalid color value"

  • Explanation: The color value provided is not recognized as a valid color name or hexadecimal code.
  • Solution: Check the color value for typos and ensure it is a valid color name or hexadecimal code.

"Image composite not provided"

  • Explanation: The img_composite parameter is required but not provided.
  • Solution: Provide an existing image for the img_composite parameter or ensure the parameter is optional in your use case.

"Text exceeds image dimensions"

  • Explanation: The text size and positioning cause it to exceed the dimensions of the image.
  • Solution: Adjust the font size, alignment, or offsets to ensure the text fits within the image boundaries.

🔧 Draw Text Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI Essentials
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.