Image Processor icon

Image Processor

Process images using sharp library

Overview

The node "Image Processor" provides image processing capabilities using the sharp library. It supports operations such as converting image formats, resizing images, cropping images, and reading basic image information including EXIF metadata. This node is useful in workflows where automated image manipulation is required, for example:

  • Converting uploaded images to a standard format like JPEG or PNG.
  • Resizing images to fit specific dimensions for web display or thumbnails.
  • Cropping images to focus on a particular area.
  • Extracting metadata from images for cataloging or analysis.

Practical examples include preparing product images for e-commerce platforms, generating thumbnails for galleries, or extracting camera information from photos.

Properties

Name Meaning
Operation The image operation to perform: Convert format, Get image info (including EXIF), Resize, or Crop.
Input Type The type of input image data: File Path, Base64 encoded string, or Binary Data.
Source Path The file path of the source image (required if Input Type is File Path).
Base64 Image The base64 encoded image data (required if Input Type is Base64).
Binary Property The binary property name containing the image data (required if Input Type is Binary Data).
Target Path The file path where the processed image will be saved (required when outputting to file for convert, resize, or crop operations).
Format The output image format: JPEG, PNG, WebP, WebP lossless, AVIF, TIFF, or same as source file.
Output Type How to output the processed image: Save to file or output as binary data.
Quality The quality of the output image (1-100), applicable mainly to lossy formats like JPEG or WebP.
Additional Description Optional additional descriptive text to embed into the image metadata (similar to PNG comments or EXIF description).

Resize-specific properties:

Name Meaning
Resize Mode Resize mode: Specify width and height directly or scale based on the longest edge.
Resolution Output resolution preset or custom resolution (format: width x height).
Custom Resolution Custom resolution string (e.g., "1920x1080") if Resolution is set to custom.
Max Dimension Maximum length of the longest edge when resizing by max dimension.
Resize Options Additional options for resizing: fit mode (contain, cover, fill, inside, outside), background color, position, whether to allow enlargement or reduction.

Crop-specific properties:

Name Meaning
Crop X Starting X coordinate of the crop area.
Crop Y Starting Y coordinate of the crop area.
Crop Width Width of the crop area.
Crop Height Height of the crop area.

Get Image Info-specific properties:

Name Meaning
Include EXIF Whether to include EXIF metadata in the output.
EXIF Encoding Encoding format for EXIF data (UTF-8, ASCII, GB2312, GBK, Latin1, Hex, Base64, raw).

Output

The node outputs an array with one item containing the result of the image operation:

  • For convert, resize, and crop operations:

    • If output type is file, the output JSON contains metadata about the saved file (such as path).
    • If output type is binaryData, the processed image is returned as binary data attached to the specified binary property.
    • The output may also include any additional description embedded into the image metadata.
  • For getImageInfo operation:

    • The output JSON includes basic image information such as dimensions, format, and optionally parsed EXIF metadata according to the selected encoding.

If an error occurs during processing and "Continue On Fail" is enabled, the output JSON will contain an error field with the error message, success: false, and the attempted operation name.

Dependencies

  • Requires the sharp image processing library (used internally).
  • No explicit external API dependencies.
  • Requires access to local filesystem paths if using file inputs or outputs.
  • Proper permissions to read/write files at specified paths are necessary.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible source file path.
    • Unsupported image format or corrupted image data.
    • Incorrectly formatted base64 input string.
    • Insufficient permissions to write to target path.
    • Specifying incompatible output format or parameters.
  • Error messages:

    • Errors related to file I/O usually indicate path or permission problems; verify paths and access rights.
    • Image decoding errors suggest invalid or unsupported input data.
    • Parameter validation errors occur if required properties are missing or incorrectly set.
  • Resolution tips:

    • Ensure input data matches the declared input type.
    • Validate all required fields before execution.
    • Use "Continue On Fail" option to handle errors gracefully in workflows.

Links and References

Discussion