Overview
This node processes images by cropping out varying white spaces and optionally resizing the cropped image according to specified parameters. It is useful for cleaning up images by removing unnecessary borders and adjusting image dimensions to fit specific size requirements. Practical applications include preparing images for web use, thumbnails, or any scenario where image size and content framing need to be controlled.
Use Case Examples
- Cropping scanned documents to remove white margins and resizing them to a standard size for consistent display.
- Processing product images by trimming excess background and resizing to fit a catalog layout.
Properties
| Name | Meaning |
|---|---|
| Binary Property | The name of the input binary property that contains the image to be processed. |
| Output Property | The name of the output binary property where the processed image will be stored. |
| Resize Option | Specifies how the image should be resized after cropping. Options include no resizing, ignoring aspect ratio, resizing to maximum or minimum area, or resizing conditionally based on image size relative to target dimensions. |
| Target Width | The desired width for resizing the image. |
| Target Height | The desired height for resizing the image. |
Output
JSON
json- Original JSON data of the input item.binarydata- Base64 encoded data of the processed (cropped and optionally resized) image.mimeType- MIME type of the processed image.fileName- Original file name of the processed image.
Dependencies
- sharp image processing library
Troubleshooting
- If the specified binary property does not exist or does not contain valid image data, the node will skip processing that item and pass it through unchanged.
- Errors related to image processing may occur if the input data is not a valid image or is corrupted. Ensure the input binary data is a valid image format supported by the sharp library.
- Incorrect resize options or target dimensions may result in unexpected image sizes or aspect ratio distortions. Verify the resize option and dimensions are set as intended.