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 provides an image resizing operation that allows users to resize images in various input formats. It supports resizing images provided as binary data from a previous node, base64-encoded strings, or via a URL pointing to the image file. Users can specify the resizing either by a percentage scale or by explicit width and height dimensions, with an option to maintain the aspect ratio.

Common scenarios for this node include:

  • Automatically resizing uploaded images before further processing or storage.
  • Preparing images for web display by reducing their size.
  • Standardizing image dimensions in workflows involving image manipulation or document generation.

Practical example:

  • A user receives images from an upload node (binary data), resizes them to 50% of their original size while maintaining aspect ratio, and then passes the resized images to a PDF generation node.

Properties

Name Meaning
Input Data Type Choose how to provide the image file to resize: "Binary Data" (from previous node), "Base64 String", or "URL".
Input Binary Field Name of the binary property containing the image file (used if Input Data Type is "Binary Data").
Base64 Image Content Base64 encoded string representing the image content (used if Input Data Type is "Base64 String").
Image URL URL to the image file to resize (used if Input Data Type is "URL").
Output File Name Desired name for the output resized image file.
Resize Type Method of resizing: "Percentage" (scale by percent) or "Specific" (set exact dimensions).
Resize Percentage Percentage to resize the image by (used if Resize Type is "Percentage").
Width Target width in pixels (used if Resize Type is "Specific").
Height Target height in pixels (used if Resize Type is "Specific").
Maintain Aspect Ratio Whether to keep the original aspect ratio when resizing (true/false).
Async Enable asynchronous processing (true/false).

Output

The node outputs the resized image data in JSON format. The output includes the resized image as binary data under a specified binary property, named according to the workflow's conventions. The output also contains metadata such as the filename set by the user.

If the input was binary data, the output will be binary data representing the resized image. If the input was base64 or URL, the output will similarly contain the resized image in binary form ready for downstream nodes.

Dependencies

  • Requires access to image processing capabilities, likely through an external API or internal library (not explicitly shown in the source).
  • May require an API key or authentication token configured in n8n credentials to access the image processing service.
  • Network access is needed if using image URLs.

Troubleshooting

  • Common issues:

    • Providing an invalid or inaccessible image URL may cause failures.
    • Incorrect base64 strings or corrupted binary data will result in errors during resizing.
    • Specifying zero or negative values for width, height, or percentage will likely cause errors.
    • Not maintaining aspect ratio when resizing to specific dimensions may distort images unexpectedly.
  • Error messages:

    • Errors related to missing or invalid input data typically indicate misconfiguration of the input properties.
    • Authentication or permission errors suggest missing or incorrect API credentials.
    • Timeout or network errors may occur when fetching images from URLs.
  • Resolutions:

    • Verify the correctness and accessibility of image URLs.
    • Ensure base64 strings are properly encoded.
    • Use valid positive numbers for resizing parameters.
    • Configure required API credentials in n8n settings.
    • Enable "Continue on Fail" in the node settings to handle individual item errors gracefully.

Links and References

Discussion