Image Format Converter icon

Image Format Converter

Image Format Converter

Overview

This node converts images from one format to another, supporting input as either a base64 string or a binary file. It is useful when you need to standardize image formats in workflows, optimize images for specific uses, or convert images to formats compatible with other systems.

Common scenarios include:

  • Converting uploaded images to JPEG for web optimization.
  • Changing image formats to meet API requirements.
  • Extracting and re-encoding images stored as base64 strings.

For example, you can input a PNG image file and output it as a compressed JPEG file with specified quality, or convert a base64-encoded GIF into a base64-encoded TIFF.

Properties

Name Meaning
Input File Type Choose whether the input image is provided as a Base64 string or as a binary file.
Base64 Field (Shown only if Input File Type is Base64) The JSON field name containing the base64 string.
Output File Format Select the desired output image format: BMP, GIF, JPG, MS BMP, PNG, or TIFF.
Output Type Choose whether the output should be a Base64 string or a binary file.
Quality For JPEG output only, set the compression quality from 0 (lowest) to 100 (highest).

Output

The node outputs an array of items corresponding to each input item processed.

  • If Output Type is "Base64", the output JSON contains a data field with the base64-encoded image string.
  • If Output Type is "File", the output includes a binary property named data with the following structure:
    • fileName: The original filename with updated extension matching the output format.
    • data: The base64-encoded image data.
    • fileType: Always "image".
    • fileSize: Approximate size in kilobytes.
    • fileExtension: The file extension matching the output format.
    • mimeType: The MIME type of the output image format.

No other JSON fields are added by default.

Dependencies

  • Uses the jimp library for image processing and format conversion.
  • Requires input images to be valid base64 strings or binary files with image MIME types.
  • No external API keys or services are needed.
  • Runs entirely within n8n environment.

Troubleshooting

  • Error: "No binary data exists on item!"
    Occurs if the input type is set to "File" but the incoming item lacks binary image data under the expected property.
    Resolution: Ensure the input item has binary data with an image MIME type.

  • Error: "No image data exists on item!"
    Happens if the binary data is present but not recognized as an image.
    Resolution: Confirm the binary data's MIME type is an image format.

  • Image conversion fails or produces corrupted output
    Could be due to unsupported or corrupted input images.
    Resolution: Validate input images before processing.

  • Quality parameter ignored for non-JPEG outputs
    The quality setting only applies to JPEG output; other formats ignore this parameter.

  • When using base64 input, ensure the specified base64 field exists and contains valid base64-encoded image data.

Links and References

Discussion