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 converts an image from one format to another. It supports input images provided as binary data, base64-encoded strings, or via a URL. Users can specify the current format of the image and the desired new format for conversion. The node is useful in workflows where image format compatibility is required, such as preparing images for web use, optimizing for different platforms, or standardizing image formats before further processing.

Practical examples:

  • Converting JPG product photos to PNG for transparent backgrounds.
  • Changing TIFF scanned documents to JPG for easier sharing.
  • Transforming BMP images to GIF for animated content preparation.

Properties

Name Meaning
Input Image Data Type Choose how to provide the image file to convert: "Binary Data" (from previous node), "Base64 String" (base64 encoded image content), or "URL" (link to image file).
Input Binary Field Name of the binary property containing the image file (used if Input Image Data Type is "Binary Data"). Default is "data".
Base64 Image Content Base64 encoded string of the image content (used if Input Image Data Type is "Base64 String").
Image URL URL pointing to the image file (used if Input Image Data Type is "URL").
Output File Name Desired name for the output converted image file, e.g., "converted_image.png".
Current Image Format The format of the input image. Options: BMP, GIF, JPG, PNG, TIFF.
New Image Format The target format to convert the image to. Options: BMP, GIF, JPG, PNG, TIFF.
Use Async Processing Whether to process the conversion asynchronously, recommended for large files. Boolean true/false.

Output

The node outputs the converted image data typically in binary form within the json output field. The output includes the converted image file with the specified filename and format. If the input was binary or base64, the output will be binary data representing the newly formatted image. If the input was a URL, the node fetches and converts the image accordingly.

If binary data is output, it represents the image file ready for downstream nodes that accept binary inputs, such as upload or storage nodes.

Dependencies

  • Requires access to image processing capabilities, likely through an internal or external library or API (not explicitly shown in the source).
  • If using URL input, requires network access to fetch the image.
  • No explicit external API keys or credentials are indicated in the provided code snippet.
  • The node may require configuration for asynchronous processing depending on environment constraints.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible image URL leading to fetch failures.
    • Unsupported or incorrectly specified current or new image formats.
    • Large image files causing timeouts or memory issues if async processing is disabled.
    • Incorrect binary property name when using binary data input.
  • Error messages and resolutions:

    • Errors related to fetching image from URL: Check URL validity and network connectivity.
    • Format not supported errors: Verify that the current and new image formats are among the supported options (BMP, GIF, JPG, PNG, TIFF).
    • Memory or timeout errors: Enable "Use Async Processing" to handle large files more efficiently.
    • Missing binary data errors: Ensure the binary property name matches the actual property containing the image data.

Links and References

Discussion