Image Processor icon

Image Processor

Process images using sharp library

Overview

The node "Image Processor" provides image manipulation capabilities using the sharp library. It supports operations such as cropping, resizing, and format conversion of images. This node is useful in workflows where automated image processing is required, for example:

  • Cropping a specific region from an image to focus on a subject.
  • Resizing images to standard dimensions for web or mobile display.
  • Converting images between formats like JPEG, PNG, WebP, etc.
  • Adding descriptive metadata to images.

Practical examples include preparing product photos for e-commerce platforms, generating thumbnails, or optimizing images for faster loading.

Properties

Name Meaning
附加描述信息 (additionalDescription) Add extra descriptive information to the image (similar to PNG comments or EXIF description). Shown for convert, resize, crop operations with file or binary output.
Input Type (inputType) The type of input image data: File Path, Base64 encoded string, or Binary Data.
Source Path (sourcePath) Path to the source image file. Required if Input Type is File Path.
Base64 Image (base64Image) Base64 encoded image data. Required if Input Type is Base64.
Binary Property (binaryProperty) Name of the binary property containing image data. Required if Input Type is Binary Data.
Target Path (targetPath) Path where the processed image will be saved. Required when outputting to file for convert, resize, crop operations.
裁切起始X坐标 (cropX) Starting X coordinate of the crop area. Used only in crop operation.
裁切起始Y坐标 (cropY) Starting Y coordinate of the crop area. Used only in crop operation.
裁切宽度 (cropWidth) Width of the crop area. Used only in crop operation.
裁切高度 (cropHeight) Height of the crop area. Used only in crop operation.
Format (format) Output image format: JPEG, PNG, WebP, WebP lossless, AVIF, TIFF, or same as source file.
输出类型 (outputType) Output mode: save processed image to file or output as binary data.
Quality (quality) Quality of the output image (1-100), applicable mainly to lossy formats like JPEG or WebP.

Output

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

  • If output type is file, the output JSON contains details about the saved file path.
  • If output type is binaryData, the processed image is returned as binary data attached to the specified binary property.

The exact structure depends on the operation but generally includes success status and either file location or binary image data.

Dependencies

  • Requires the sharp image processing library (used internally).
  • No external API keys or services are needed.
  • The node expects valid image input either as a file path, base64 string, or binary data.
  • Proper file system permissions are necessary when saving files.

Troubleshooting

  • Common issues:

    • Invalid or inaccessible source file path.
    • Incorrect base64 string or corrupted binary data.
    • Crop coordinates or dimensions exceeding image bounds.
    • Unsupported image format for input or output.
    • Insufficient permissions to write to target path.
  • Error messages:

    • Errors related to file reading/writing usually indicate path or permission problems.
    • Processing errors may occur if input data is malformed or unsupported.
    • Quality values outside 1-100 range might cause unexpected behavior.
  • Resolutions:

    • Verify input paths and data integrity.
    • Ensure crop parameters are within image size limits.
    • Use supported image formats.
    • Check folder permissions for writing output files.

Links and References

Discussion