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 Image Watermark To Image" allows users to overlay a watermark image onto another image. It supports multiple input methods for both the main image and the watermark, including binary data from previous nodes, base64 encoded strings, or URLs. Users can customize the watermark's position, opacity, rotation, and offsets to precisely control how the watermark appears on the target image.

Common scenarios include branding images with logos, protecting photos by adding copyright marks, or visually marking images for internal use. For example, a marketing team might automatically add their company logo as a watermark to product images before publishing them online.

Properties

Name Meaning
Input Image Data Type How the main image is provided: Binary Data, Base64 String, or URL
Input Binary Field Name of the binary property containing the main image file (used if Input Image Data Type is Binary Data)
Base64 Image Content Base64 encoded string of the main image content (used if Input Image Data Type is Base64)
Image URL URL pointing to the main image file (used if Input Image Data Type is URL)
Watermark Image Data Type How the watermark image is provided: Binary Data, Base64 String, or URL
Watermark Binary Field Name of the binary property containing the watermark image (used if Watermark Image Data Type is Binary Data)
Base64 Watermark Content Base64 encoded string of the watermark image content (used if Watermark Image Data Type is Base64)
Watermark Image URL URL pointing to the watermark image file (used if Watermark Image Data Type is URL)
Output File Name Desired filename for the output image with the watermark
Position Position of the watermark on the image; options include Top Right, Top Left, Bottom Right, Bottom Left, Central Horizontal, Central Vertical, Diagonal, Custom
Opacity Opacity level of the watermark, from 0.0 (fully transparent) to 1.0 (fully opaque)
Horizontal Offset Integer horizontal offset to adjust watermark position
Vertical Offset Integer vertical offset to adjust watermark position
Position X X coordinate for custom watermark positioning (used if Position is Custom)
Position Y Y coordinate for custom watermark positioning (used if Position is Custom)
Rotation Rotation angle in degrees to rotate the watermark
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 contains the image file with the watermark applied according to the configured settings. This binary data can be used downstream in workflows for saving, uploading, or further processing.

Dependencies

  • The node requires access to image data either from previous nodes (binary), base64 strings, or URLs.
  • No external API keys or services are explicitly required based on the static code analysis.
  • Proper handling of binary data within n8n is necessary.
  • Network access may be needed if URLs are used to fetch images or watermarks.

Troubleshooting

  • Common Issues:

    • Incorrect binary property names may cause the node to fail to find the image or watermark data.
    • Invalid or inaccessible URLs will result in errors fetching the images.
    • Providing malformed base64 strings will cause decoding failures.
    • Setting opacity outside the 0.0 to 1.0 range may lead to unexpected results.
    • Using custom positions without proper coordinates may place the watermark off-canvas.
  • Error Messages:

    • Errors related to missing binary data typically indicate incorrect binary field names or missing prior node outputs.
    • Network errors when fetching URLs suggest connectivity issues or invalid URLs.
    • Decoding errors for base64 inputs indicate improperly formatted strings.
  • Resolutions:

    • Verify binary field names match those output by previous nodes.
    • Ensure URLs are reachable and point directly to image files.
    • Validate base64 strings before input.
    • Use the provided UI controls to set valid opacity and position values.

Links and References

Discussion