PDF4me icon

PDF4me

Comprehensive PDF and document processing: generate barcodes, convert files, extract data, manipulate images, and automate workflows with the PDF4ME API

Actions80

Overview

This node operation "Add Text Watermark To Image" allows users to add a customizable text watermark onto an image. It supports multiple input methods for the source image, including binary data from a previous node, a base64 encoded string, or a direct URL to the image file.

Common scenarios where this node is beneficial include:

  • Branding images by adding company logos or copyright text.
  • Marking images as drafts or confidential by overlaying specific text.
  • Adding watermarks for digital rights management or content protection.

Practical example: A marketing team can automatically watermark all product images with their brand name before publishing them online, ensuring consistent branding and discouraging unauthorized use.

Properties

Name Meaning
Input Image Data Type Choose how to provide the image file to watermark. Options: Binary Data (image from previous node), Base64 String (base64 encoded image content), URL (link to image file).
Input Binary Field Name of the binary property containing the image file (used when Input Image Data Type is Binary Data).
Base64 Image Content Base64 encoded image content (used when Input Image Data Type is Base64 String).
Image URL URL to the image file (used when Input Image Data Type is URL).
Output File Name Name for the output image file with the watermark applied. Default is "image_with_text_watermark.jpg".
Watermark Text The actual text string to be used as the watermark on the image.
Text Position Position of the watermark text on the image. Options: Top Right, Top Left, Bottom Right, Bottom Left, Central Horizontal, Central Vertical, Diagonal, Custom.
Font Family Font family used for the watermark text, e.g., Arial.
Font Size Font size for the watermark text, specified as an integer.
Text Color Color of the watermark text in hex format, e.g., #b4351a.
Bold Boolean flag to make the watermark text bold.
Underline Boolean flag to underline the watermark text.
Italic Boolean flag to italicize the watermark text.
Opacity Opacity level of the watermark text, ranging from 0.0 (fully transparent) to 1.0 (fully opaque).
Rotation Angle Rotation angle in degrees to rotate the watermark text. Can be a float value.
Position X X coordinate for custom positioning of the watermark text (used only if Text Position is set to Custom).
Position Y Y coordinate for custom positioning of the watermark text (used only if Text Position is set to Custom).
Use Async Processing Boolean flag indicating whether to use asynchronous processing, which is recommended for large files to improve performance.

Output

The node outputs the processed image with the text watermark applied. The output includes:

  • A JSON object containing metadata about the resulting image.
  • The image itself is provided as binary data under a specified binary property.
  • The output file name corresponds to the configured "Output File Name" property.

If the input was binary or base64, the output will be binary data representing the watermarked image. If the input was a URL, the output similarly provides the watermarked image as binary data.

Dependencies

  • This node requires access to an image processing service or library capable of rendering text onto images.
  • No explicit external API keys or credentials are indicated in the provided code snippet.
  • The node may require proper configuration of binary data handling within n8n workflows.
  • Asynchronous processing option suggests that the node can handle large files efficiently, possibly leveraging background tasks or external services.

Troubleshooting

  • Common Issues:

    • Incorrect input data type selected: Ensure the "Input Image Data Type" matches the actual input (binary, base64, or URL).
    • Missing or incorrect binary property name when using binary input.
    • Invalid base64 string or malformed URL leading to failure in loading the image.
    • Unsupported font family or invalid color codes causing rendering issues.
    • Large image files might cause timeouts or slow processing if asynchronous processing is disabled.
  • Error Messages:

    • Errors related to image loading failures usually indicate problems with the input image source.
    • Text rendering errors may occur if font settings are invalid.
    • Timeout or memory errors suggest enabling "Use Async Processing" for better handling of large files.
  • Resolutions:

    • Double-check input properties and ensure they align with the actual data.
    • Validate URLs and base64 strings before running the node.
    • Use standard fonts and valid hex color codes.
    • Enable asynchronous processing for large images.

Links and References

Discussion