Actions132
- AI Actions
- Extract Text From Document
- Check Content Policy
- Detect Adult Content
- Detect Brand
- Detect Color
- Detect Email Type
- Detect Faces
- Extract Entities
- Extract Contact Information
- Extract Customizable Information From Text
- Fuzzy Text Matcher
- Generate Image
- Generate JavaScript Code
- Generate Python Code
- Detect Language
- Detect Mood
- Extract Text From PDF
- Recognize Objects in Image
- Extract Text From Image
- Redact Sensitive Information From PDF
- Remove Background Image
- Summarize Text
- Transcribe
- Translate Text
- Image Actions
- Business Actions
- Convert Actions
- Generate Actions
- Crypto Actions
- Operator Actions
- Storage Actions
- Scheduler Actions
- Text Actions
- Chart Actions
- Code Actions
- Calculate Actions
- Date and Time Actions
- PDF Actions
- Compress PDF File
- Count PDF Pages
- Create Empty PDF
- Decrypt PDF
- Convert DOCX to PDF
- Draw Image on PDF
- Draw Text on PDF
- Encrypt PDF
- Convert HTML to PDF
- Convert Markdown to PDF
- Manage PDF Metadata
- Merge PDF Files
- Add PDF Pages
- Remove PDF Pages
- Resize PDF Pages
- Rotate PDF Pages
- Convert PDF to Base64
- Convert PDF to Image
- Split PDF File
- Add Image Watermark to PDF
- Add Text Watermark to PDF
- Shortened URL Actions
Image → Crop Image
AI-generatedOverview
The "Crop Image" operation of the Image resource in this node allows users to crop an image by specifying the cropping rectangle's position and size. The image can be provided either as a publicly accessible URL or as a base64-encoded buffer. This operation is useful for scenarios where you need to extract a specific portion of an image, such as focusing on a subject, removing unwanted borders, or preparing images for thumbnails or previews.
Practical examples include:
- Cropping profile pictures uploaded by users to a fixed size.
- Extracting a logo or watermark area from a larger image.
- Preparing product images by cropping to highlight the product only.
Properties
| Name | Meaning |
|---|---|
| Data Type | Choose the source type of the image: URL (publicly accessible image URL) or Buffer (base64-encoded image data). |
| Image URL | The URL of the image to crop. Must be publicly accessible. Used only if Data Type is set to URL. |
| Image Buffer | Base64-encoded image data to crop. Used only if Data Type is set to Buffer. |
| Crop Settings | JSON object defining the crop rectangle with properties: top (pixels from top), left (pixels from left), width (crop width in pixels), and height (crop height in pixels). Example: {"top":50,"left":50,"width":200,"height":200} |
Output
The output will contain the cropped image data. Although the exact structure is not explicitly shown in the code snippet, typically the output JSON will include the cropped image either as a URL or as base64-encoded data depending on the input type and API response.
If binary data is returned, it would represent the cropped image file content suitable for further processing or saving.
Dependencies
- Requires an API key credential for authentication with the external 0CodeKit service.
- The node sends a POST request to the
/image/cropendpoint of the 0CodeKit API (https://prod.0codekit.com/image/crop). - The user must ensure that the image URL is publicly accessible if using the URL option.
- No additional local dependencies are required; all processing is done via the external API.
Troubleshooting
- Image URL inaccessible: If the image URL is not publicly accessible or returns an error, the crop operation will fail. Ensure the URL is reachable without authentication.
- Invalid base64 data: When using the buffer option, invalid or corrupted base64 strings will cause errors. Verify the base64 encoding is correct.
- Incorrect crop dimensions: Specifying crop coordinates outside the bounds of the image may result in errors or unexpected results. Double-check the
top,left,width, andheightvalues. - API authentication errors: Missing or invalid API credentials will prevent the request from succeeding. Confirm the API key is correctly configured in n8n credentials.
- Malformed JSON in Crop Settings: The crop settings must be valid JSON. Invalid JSON syntax will cause the node to error out.
Links and References
- 0CodeKit API Documentation (general reference for the API base URL)
- Base64 Encoding Guide (for understanding base64 image buffers)
- Image Cropping Concepts (general info about image cropping)
This summary is based solely on static analysis of the provided source code and property definitions.