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 image compression functionality within an n8n workflow. It allows users to compress images supplied in various formats—binary data from a previous node, base64-encoded strings, or via a URL. The node supports outputting the compressed image in either JPG or PNG format and offers configurable compression levels (Max, Medium, Low). Additionally, it can process large files asynchronously to improve performance.

Typical use cases include optimizing images for web usage by reducing file size without significant quality loss, preparing images for email attachments, or automating image optimization workflows in content management systems.

Properties

Name Meaning
Input Image Data Type Choose how to provide the image file to compress. Options: Binary Data (from previous node), Base64 String, URL 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 string representing the image content (used when Input Image Data Type is Base64 String).
Image URL URL pointing to the image file to compress (used when Input Image Data Type is URL).
Output File Name Desired name for the output compressed image file.
Image Type Output format for the compressed image. Options: JPG, PNG.
Compression Level Compression intensity level. Options: Max, Medium, Low.
Use Async Processing Whether to use asynchronous processing for large files (true/false).

Output

The node outputs the compressed image data in the json field of the returned items. The compressed image is typically provided as binary data under the specified output binary property (not explicitly shown but standard for image processing nodes). The output includes the compressed image file with the chosen filename and format.

If the node handles binary data input, the output will be binary data representing the compressed image. For base64 or URL inputs, the output similarly contains the compressed image data ready for further workflow steps.

Dependencies

  • Requires access to an external image compression service or library integrated within the node's implementation.
  • No explicit API keys or credentials are mentioned in the source code snippet; however, depending on the underlying service used for compression, an API key credential might be required.
  • No special environment variables are indicated.

Troubleshooting

  • Common Issues:

    • Providing an incorrect binary property name when using binary data input may cause the node to fail to locate the image.
    • Invalid base64 strings or inaccessible URLs will result in errors during image retrieval.
    • Unsupported image formats or corrupted image files may cause compression to fail.
    • Large files might time out if asynchronous processing is disabled.
  • Error Messages:

    • Errors related to missing input data or invalid input format usually indicate misconfiguration of the input properties.
    • Network errors when using URL input suggest connectivity issues or invalid URLs.
    • Compression failures might require checking the input image integrity or adjusting compression level settings.
  • Resolutions:

    • Verify that the binary property name matches the actual binary data field.
    • Ensure base64 strings are correctly encoded and complete.
    • Confirm URLs are accessible and point directly to image files.
    • Enable asynchronous processing for large images to avoid timeouts.

Links and References

Discussion