0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions108

Overview

The node provides image manipulation capabilities as part of a broader no-code utility toolbox. Specifically, for the Image resource and the Crop operation, it allows users to crop an image by specifying the cropping rectangle (top, left, width, height) and optionally the axis on which to crop.

This node is beneficial in scenarios where you need to programmatically trim or focus on a specific part of an image within an automated workflow. For example, cropping user-uploaded profile pictures to a standard size or extracting a region of interest from images before further processing.

Properties

Name Meaning
Code Variables Allows defining multiple code variables by selecting variable names/IDs from a list or specifying them via expressions, each with an associated value. These variables can be used in custom code execution contexts.
Type of Data Specifies the input type of the image data: either a publicly accessible URL or a Buffer containing the image data.
URL The publicly accessible URL of the image to crop. Required if "Type of Data" is set to URL.
Buffer The image data buffer to crop. Required if "Type of Data" is set to Buffer.
Options Cropping JSON object specifying the cropping rectangle with properties: top, left, width, and height. Defines the area of the image to keep after cropping. Defaults to { "top": 0, "left": 0, "width": 100, "height": 100 }.
Axis Optional string to specify the axis on which to crop. Usage depends on implementation context.
File Name Optional filename of the image being operated on. Useful for naming output files or metadata purposes.
Get File as URL Boolean flag indicating whether the output image should be returned as a URL (true) or in another form such as a buffer (false). Defaults to true.

Output

  • The node outputs a JSON array where each item corresponds to the result of the crop operation on an input image.
  • The exact structure of the output JSON is not explicitly detailed in the source, but typically it will include:
    • The cropped image data, either as a URL (if Get File as URL is true) or as binary data.
    • Metadata such as the filename if provided.
  • If binary data is output, it represents the cropped image content suitable for downstream nodes that handle binary files.

Dependencies

  • Requires an API key credential for authentication with the external service providing the image processing functionality.
  • The node sends requests to an external API endpoint corresponding to the resource and operation (e.g., image/crop).
  • The image URL must be publicly accessible if using the URL input type.
  • No other explicit environment variables or configurations are indicated.

Troubleshooting

  • Common Issues:

    • Providing a non-public or inaccessible image URL will cause failures since the service cannot fetch the image.
    • Incorrectly formatted JSON in the cropping options may lead to errors.
    • Omitting required fields like the image URL or buffer depending on the selected data type.
    • Using invalid coordinates or dimensions in the cropping options (e.g., negative values or exceeding image bounds).
  • Error Messages:

    • Errors related to network access or authorization likely indicate issues with the API key or image accessibility.
    • JSON parsing errors suggest malformed input in the cropping options.
    • Validation errors may occur if required parameters are missing or invalid.
  • Resolutions:

    • Ensure the image URL is publicly accessible without authentication.
    • Validate JSON syntax for cropping options before running the node.
    • Provide all required inputs according to the selected data type.
    • Use sensible cropping coordinates within the image dimensions.

Links and References

Discussion