Actions9
Overview
The "Crop Image" operation of the Mallabe Images node allows users to crop an image from a public URL based on specified dimensions and a pivot point (gravity). This operation is useful for extracting a specific portion of an image, such as focusing on a subject or removing unwanted borders. It supports manual cropping by specifying exact X and Y offsets or automatic cropping relative to predefined positions like center, top-left, bottom-right, etc.
Practical examples include:
- Cropping profile pictures to a square centered on the face.
- Extracting a logo area from a larger banner image.
- Removing margins from scanned documents before further processing.
Properties
| Name | Meaning |
|---|---|
| Image URL | Public URL of the image file to crop. The image must be accessible without authentication. |
| Gravity | Defines the pivot point from which to start cropping. Options: Manual, Center, Top, Left, Bottom, Right, Top-Left, Top-Right, Bottom-Left, Bottom-Right. |
| Crop Width | Width of the region to crop. Can be specified in pixels or percentage (depending on the API's interpretation). |
| Crop Height | Height of the region to crop. Can be specified in pixels or percentage. |
| Left (X Axis) | Offset from the left edge in pixels. Only relevant when Gravity is set to Manual. |
| Top (Y Axis) | Offset from the top edge in pixels. Only relevant when Gravity is set to Manual. |
| Download Image? | Boolean flag indicating whether to download the cropped image binary data or just return a link to it. |
| Put Output File In Field | When downloading the image, this specifies the name of the output field where the binary file data will be stored. |
| Webhook URL (Advanced) | Optional URL to send a webhook with the data of the operation after processing. |
Output
The node outputs JSON data containing details about the cropped image, including at least a URL to the processed image.
- If Download Image? is set to
false, the output JSON contains the response data with the cropped image URL. - If Download Image? is
true, the node downloads the cropped image binary data from the returned URL and outputs it in the specified binary field alongside the JSON metadata.
The binary data represents the actual cropped image file, ready for use in subsequent workflow steps that accept binary inputs.
Dependencies
- Requires an active connection to the Mallabe Images API service.
- Needs an API key credential configured in n8n for authenticating requests to the Mallabe Images API.
- The input image URL must be publicly accessible or accessible by the Mallabe Images API; protected URLs may not work.
- Optional webhook URL can be provided to receive asynchronous notifications or results.
Troubleshooting
- Invalid or inaccessible Image URL: The node may fail if the image URL is not publicly accessible or points to a non-image resource. Ensure the URL is correct and reachable.
- Unsupported image formats: Some image formats might not be supported by the API, leading to errors or no conversion.
- Incorrect gravity or coordinates: When using manual gravity, ensure X and Y offsets are within the bounds of the image dimensions.
- API authentication errors: Verify that the API key credential is correctly set up and has necessary permissions.
- Download failures: If downloading the cropped image fails, check network connectivity and that the returned URL is valid and accessible.
- Webhook URL issues: If using a webhook URL, ensure it is reachable and properly handles incoming POST requests.
Links and References
- Mallabe Images API Documentation (hypothetical link as no real URL provided)
- n8n documentation on Creating Custom Nodes
- General image cropping concepts: Image Cropping - Wikipedia