Skip to main content

Add Text To Image

Adds text to an image at a specified position with customizable styling options.

Common Properties​

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs​

  • In Path - Path to the input image file.
  • Text - The text to be added to the image.
  • Height of Text Box - Height of the text box in pixels.
  • Width of Text Box - Width of the text box in pixels.
  • X Coordinate of Text - X coordinate position for placing the text on the image.
  • Y Coordinate of Text - Y coordinate position for placing the text on the image. Increasing Y coordinate will move text downward.
  • Out Path - Path where the output image with added text will be saved.

Options​

  • Font Name - Font family to use for the text. Default is Calibri.
  • Background Color - Background color of the text box. Options include red, white, black, or transparent.
  • Ignore Aspect Ratio - Whether to ignore aspect ratio when resizing. Default is true.
  • Text Fill Color - Color of the text fill. Default is #000000 (black).
  • Text Alignment - Alignment of the text within the text box. Options are left, center, or right. Default is left.

Output​

  • result - Boolean indicating success or failure of the text addition operation.

How It Works​

The Add Text To Image node uses ImageMagick library to add customizable text to images. When executed, the node:

  1. Validates all input parameters including file paths, dimensions, and coordinates
  2. Loads the specified input image
  3. Configures text rendering settings including font, colors, alignment, and dimensions
  4. Creates a text overlay with the specified properties
  5. Composites the text onto the image at the specified coordinates
  6. Saves the resulting image to the output path

Requirements​

  • Valid input image file at the specified path
  • Output path must be writable
  • Valid numeric values for height, width, and coordinates
  • Non-empty text string to add to the image

Error Handling​

The node will return specific errors in the following cases:

  • Empty or invalid input file path
  • Input file not found at the specified path
  • Empty text string
  • Invalid height or width values (must be greater than zero)
  • Invalid coordinate values (must be greater than or equal to zero)
  • Empty or invalid output file path
  • Invalid background color selection
  • Invalid text alignment selection

Usage Notes​

  • Ensure the input image file exists and is accessible
  • Verify that the output path is writable
  • Coordinate system starts from the top-left corner (0,0)
  • Text alignment affects how the text is positioned within the specified text box
  • Font availability depends on the system where the automation runs
  • Large text boxes may affect performance