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

The node provides an image compression operation that reduces the file size of images while maintaining acceptable quality. It supports multiple input methods for the image, including binary data from a previous node, base64 encoded strings, or direct URLs to image files. Users can specify output format and compression level, making it useful for optimizing images before storage, transmission, or display in web applications.

Common scenarios include:

  • Compressing user-uploaded images to reduce bandwidth usage.
  • Preparing images for faster loading on websites or mobile apps.
  • Reducing storage costs by compressing large image files.
  • Automating image optimization workflows in content management systems.

Example: A workflow receives images as binary data from an upload node, compresses them to JPG with medium compression, and outputs smaller images ready for publishing.

Properties

Name Meaning
Input Image Data Type How the image is provided: "Binary Data" (from previous node), "Base64 String", or "URL".
Input Binary Field Name of the binary property containing the image file (used if Input Image Data Type is Binary).
Base64 Image Content Base64 encoded string of the image content (used if Input Image Data Type is Base64).
Image URL URL pointing to the image file (used if Input Image Data Type is URL).
Output File Name Desired filename for the compressed image output (e.g., "compressed_image.jpg").
Image Type Output image format: "JPG" or "PNG".
Compression Level Compression intensity: "Max", "Medium", or "Low".
Binary Data Output Name Custom name for the binary data field in the node's output (default is "data").

Output

The node outputs the compressed image as binary data under a customizable binary property name (default "data"). The JSON output contains metadata about the processed item, but the main payload is the compressed image binary data suitable for further processing or saving.

If the input was binary data or base64, the output will be the compressed image binary. If the input was a URL, the node downloads, compresses, and outputs the compressed image binary.

Dependencies

  • Requires internet access if using image URLs.
  • No explicit external API keys or credentials are indicated in the source code.
  • Compression logic is handled internally or via bundled dependencies (not shown explicitly).
  • No special environment variables or n8n configurations appear necessary.

Troubleshooting

  • Invalid Input Data: Providing an incorrect binary property name or malformed base64 string may cause errors. Ensure the input matches the selected input type.
  • Unsupported Image URLs: URLs must point directly to accessible image files; redirects or protected URLs may fail.
  • Compression Errors: Extremely large images or unsupported formats might cause failures.
  • Output Naming Conflicts: Using duplicate binary data output names in the workflow could overwrite data unintentionally.

Common error messages likely relate to invalid input data or network issues when fetching images from URLs. To resolve, verify input correctness and URL accessibility.

Links and References

Discussion