Text Overlay:
The TextOverlayNode is designed to enhance images by overlaying text onto them, providing a versatile tool for adding captions, annotations, or any textual information directly onto an image. This node is particularly beneficial for creating visually appealing graphics where text needs to be integrated seamlessly with the image. It allows for customization of text appearance, including font size, color, and background settings, ensuring that the text is both legible and aesthetically pleasing. The node's ability to position text precisely on the image, either by specific pixel coordinates or as a percentage of the image size, offers flexibility in design. This makes it an essential tool for artists and designers looking to add informative or decorative text to their visual projects.
Text Overlay Input Parameters:
image
This parameter represents the image onto which the text will be overlaid. It serves as the canvas for the text overlay operation.
text
This is the text string that you want to overlay on the image. It supports multiline input and defaults to "Hello World". The text content is crucial as it determines the message or information conveyed on the image.
font_size
This parameter controls the size of the text font. It accepts values ranging from 1 to 1024, with a default of 32. Adjusting the font size impacts the readability and prominence of the text on the image.
text_color
This parameter specifies the color of the text in hexadecimal format, defaulting to "FFFFFF" (white). The text color is important for ensuring contrast and visibility against the image background.
bg_color
This parameter defines the background color behind the text, also in hexadecimal format, with a default of "000000" (black). The background color helps in making the text stand out, especially when the image has a complex or colorful background.
draw_background
This boolean parameter determines whether a background should be drawn behind the text. It defaults to True, meaning a background will be drawn, which can enhance text visibility.
bg_padding
This parameter sets the padding around the text background, with a range from 0 to 1024 and a default of 10. Padding affects the spacing between the text and its background, influencing the overall text block appearance.
bg_transparency
This parameter controls the transparency level of the text background, ranging from 0.0 (fully transparent) to 1.0 (fully opaque), with a default of 0.5. Transparency allows for blending the text background with the image, creating a more integrated look.
use_percentage
This boolean parameter, when set to True, treats the top, bottom, left, and right positioning values as percentages of the image size, rather than absolute pixel values. This allows for more flexible and responsive text positioning.
top
This parameter specifies the top offset for the text placement, with a range from -1 to 8192 and a default of -1. A value of -1 centers the text vertically or uses the bottom offset if specified.
bottom
This parameter sets the bottom offset for text placement, with a range from -1 to 8192 and a default of -1. A value of -1 centers the text vertically or uses the top offset if specified.
left
This parameter determines the left offset for text placement, with a range from -1 to 8192 and a default of -1. A value of -1 centers the text horizontally or uses the right offset if specified.
right
This parameter specifies the right offset for text placement, with a range from -1 to 8192 and a default of -1. A value of -1 centers the text horizontally or uses the left offset if specified.
Text Overlay Output Parameters:
image_with_text
This output parameter represents the image with the text overlay applied. It is the final product of the node's operation, combining the original image with the specified text and styling options.
Text Overlay Usage Tips:
- To ensure text readability, choose a text color that contrasts well with the image background. Adjust the
bg_colorandbg_transparencyto enhance visibility if needed. - Use the
use_percentageoption for responsive designs where the image size may vary, ensuring consistent text placement across different image dimensions. - Experiment with
font_sizeandbg_paddingto achieve the desired text prominence and spacing, especially when dealing with images of varying resolutions.
Text Overlay Common Errors and Solutions:
Invalid color format
- Explanation: The text or background color is not specified in the correct hexadecimal format.
- Solution: Ensure that the color values are provided as six-character hexadecimal strings, such as "FFFFFF" for white.
Text exceeds image boundaries
- Explanation: The text size or positioning causes it to extend beyond the image edges.
- Solution: Adjust the
font_size,bg_padding, or positioning parameters to fit the text within the image boundaries.
Transparency value out of range
- Explanation: The
bg_transparencyvalue is set outside the allowed range of 0.0 to 1.0. - Solution: Ensure the transparency value is within the specified range to avoid errors in rendering the text background.
