Image Processor

Process images using sharp library

裁切

AI-generated

Overview

This node performs image cropping operations. It allows users to specify the cropping area by defining the starting X and Y coordinates, as well as the width and height of the crop region. The node supports input images from file paths, base64 strings, or binary data, and can output the cropped image either saved to a file or as binary data. This is useful for scenarios where you need to extract a specific portion of an image, such as focusing on a subject or removing unwanted parts.

Use Case Examples

  1. Cropping a product image to highlight the product only.
  2. Extracting a face from a group photo for profile pictures.
  3. Removing borders or margins from scanned documents.

Properties

Name Meaning
附加描述信息 为图像添加附加描述信息(类似于PNG的comments或EXIF的description)
Input Type The type of input for the image
Source Path The path of the source image file (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 containing the image data (required if Input Type is Binary Data)
Target Path The path where the processed (cropped) image will be saved (required if output type is file)
裁切起始X坐标 裁切区域的起始X坐标
裁切起始Y坐标 裁切区域的起始Y坐标
裁切宽度 裁切区域的宽度
裁切高度 裁切区域的高度
Format The format of the output image
输出类型 选择输出方式:保存到文件或输出为Binary Data
Quality The quality of the output image (1-100)

Output

JSON

  • error - Error message if the operation fails
  • success - Boolean indicating if the operation was successful
  • operation - The image processing operation performed (crop)

Dependencies

  • sharp library for image processing

Troubleshooting

  • Ensure the source image path or input data is correct and accessible.
  • Verify that the crop coordinates and dimensions are within the bounds of the source image.
  • Check that the output path is writable if saving to a file.
  • If using binary data input, confirm the binary property name is correct and contains valid image data.
  • Common errors include file not found, invalid image format, or out-of-bound crop dimensions. These can be resolved by correcting the input parameters and ensuring file system permissions.

Discussion