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 add a watermark image onto another image. It supports multiple ways of providing both the input image and the watermark image, including binary data from previous nodes, base64 encoded strings, or URLs. Users can customize the watermark's position, opacity, rotation, and offsets, enabling flexible watermark placement.

Common scenarios where this node is beneficial include:

  • Branding images by adding company logos as watermarks.
  • Protecting images from unauthorized use by overlaying a watermark.
  • Batch processing images to apply consistent watermarking for marketing or publishing.

Practical example: A user has product photos and wants to add their logo as a semi-transparent watermark in the bottom right corner before publishing them online.

Properties

Name Meaning
Input Image Data Type How the input image is provided. Options: Binary Data (from previous node), Base64 String (encoded image content), URL (link to image file).
Input Binary Field Name of the binary property containing the input image file (used if Input Image Data Type is Binary Data).
Base64 Image Content Base64 encoded string of the input image content (used if Input Image Data Type is Base64 String).
Image URL URL to the input image file (used if Input Image Data Type is URL).
Watermark Image Data Type How the watermark image is provided. Options: Binary Data (from previous node), Base64 String (encoded watermark image), URL (link to watermark image file).
Watermark Binary Field Name of the binary property containing the watermark image file (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 String).
Watermark Image URL URL 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 applied.
Position Position of the watermark on the image. Options: 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 image.
Use Async Processing Whether to process large files asynchronously for better performance.

Output

The node outputs the watermarked image as binary data under a specified binary property (usually named data or similar). The output includes:

  • json: Metadata about the processed image (e.g., filename).
  • binary: The actual image file with the watermark applied, ready for further processing or saving.

If the input was binary data, the output will be binary data representing the new image with the watermark applied.

Dependencies

  • This node requires no external API keys or services; it processes images internally.
  • It depends on upstream nodes or inputs providing image data either as binary, base64 strings, or accessible URLs.
  • For URL inputs, the node must have internet access to fetch images.
  • No special environment variables are required.

Troubleshooting

  • Common issues:

    • Providing incorrect binary property names may cause the node to fail to find the input image or watermark.
    • Invalid base64 strings or inaccessible URLs will result in errors fetching or decoding images.
    • Using very large images without async processing might lead to timeouts or memory issues.
    • Incorrect position or offset values may place the watermark outside the visible area.
  • Error messages and resolutions:

    • "Input binary property not found": Verify the binary field name matches the incoming data.
    • "Failed to load image from URL": Check the URL is correct and accessible.
    • "Invalid base64 content": Ensure the base64 string is properly formatted and complete.
    • Timeout or memory errors: Enable "Use Async Processing" to handle large files more efficiently.

Links and References

Discussion