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. Users can specify the watermark text, its position, font styling, color, opacity, rotation, and output file naming.

Common scenarios where this node is beneficial include:

  • Branding images by adding company logos or copyright text.
  • Marking images as confidential or draft by overlaying specific text.
  • Adding watermarks to photos before sharing them publicly to protect ownership.

Practical example:

  • A marketing team wants to batch process product images by adding a semi-transparent "Sample" text diagonally across each image to prevent unauthorized use.

Properties

Name Meaning
Input Image Data Type Choose how to provide the image file to watermark:
- Binary Data (image file 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.
Watermark Text The 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 for the watermark text (e.g., Arial).
Font Size Font size for the watermark text (integer value).
Text Color Text color in hexadecimal format (e.g., #b4351a).
Bold Boolean to make the watermark text bold.
Underline Boolean to underline the watermark text.
Italic Boolean 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 for the watermark text (can be float).
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).
Binary Data Output Name Custom name for the binary data field in the node's output.

Output

The node outputs the watermarked image as binary data under the specified binary data output name (default is "data"). The output JSON contains metadata about the processed item, and the binary field holds the resulting image file with the applied text watermark.

If the input was binary data, the output will be a modified binary image file. If the input was base64 or URL, the output similarly provides the watermarked image as binary data ready for further processing or saving.

Dependencies

  • Requires access to the image data either via previous node binary data, base64 string, or accessible image URL.
  • No external API keys or services are explicitly required based on the static code analysis.
  • The node depends on internal libraries for image processing and watermark application.

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible image URL may cause failures in loading the image.
    • Incorrect base64 strings or corrupted binary data will result in errors during image processing.
    • Specifying unsupported font families might fallback to defaults or cause rendering issues.
    • Using custom positions without proper coordinates may place the watermark off-image or not visible.
  • Error messages and resolutions:

    • Errors related to image loading usually indicate problems with the input data; verify URLs or binary inputs.
    • Font-related errors suggest checking the font family name or using standard fonts.
    • If the node fails and "Continue On Fail" is disabled, the workflow stops; enabling it allows partial processing with error reporting.

Links and References

Discussion