1001fx - NoCode functions icon

1001fx - NoCode functions

1001fx is a set of functions for any automation platform. Our functions are simple, very well tested, scalable and offer features that most automation platforms do not offer.

Actions74

images → Crops an image by the given x, y, width and height paramters.

AI-generated

Overview

This node provides an image cropping function as part of the "images" resource. It allows users to crop an input image by specifying the starting coordinates (X, Y) and the dimensions (width, height) of the desired crop region. The cropped image is then output as binary data, which can be used in subsequent workflow steps for further processing, storage, or delivery.

Common scenarios:

  • Automatically cropping profile pictures to a standard size.
  • Extracting specific regions from scanned documents or screenshots.
  • Preparing images for thumbnails or previews.

Practical example:
A user uploads a photo and wants to extract only the face area for use as an avatar. By specifying the X, Y, width, and height, this node will return just the selected portion of the image.


Properties

Name Meaning
X coordinate The x coordinate to start cropping from. Defaults to 0 if not specified.
Y coordinate The y coordinate to start cropping from. Defaults to 0 if not specified.
Crop width The width of the crop region. Defaults to the image's width if not specified.
Crop height The height of the crop region. Defaults to the image's height if not specified.
Image file Image file to be processed. This is required and should reference the input image.
Binary Property Name of the binary property where the cropped image will be stored (default: "data").

Output

  • Binary Data:
    The node outputs the cropped image as binary data under the property name specified by "Binary Property".
    • The binary field contains the cropped image file.
    • The original JSON data is preserved alongside the new binary data.

Example output structure:

{
  "json": { /* original item data */ },
  "binary": {
    "data": {
      "data": "<base64-encoded-cropped-image>",
      "fileName": "cropped_image.png",
      "mimeType": "image/png"
    }
  }
}

(The actual property name may differ if "Binary Property" is set to another value.)


Dependencies

  • External Service:
    Requires access to the 1001fx API.
  • API Credentials:
    Needs valid 1001fxApi credentials configured in n8n.
  • n8n Configuration:
    The input image must be available as binary data in the incoming item.

Troubleshooting

Common issues:

  • Missing or invalid image file:
    If the "Image file" property does not reference a valid binary property, the node will fail.
  • Invalid crop parameters:
    Specifying coordinates or dimensions outside the bounds of the image may result in errors or empty output.
  • Authentication errors:
    If the 1001fx API credentials are missing or incorrect, the node will throw authentication errors.

Error messages:

  • "error": "Cannot read property 'fileName' of undefined"
    • Ensure that the input item contains the correct binary property with the image file.
  • "error": "Request failed with status code 401"
    • Check your 1001fx API credentials in n8n.

Links and References

Discussion