Crop Image using n8n action
PDF4me Crop Image extracts precise image areas through n8n automation workflows. Process images via n8n triggers, binary data, base64 strings, or public URLs to crop using border removal (specify pixels to remove from left/right/top/bottom) or rectangle selection (define coordinates and dimensions) with preserved image quality and flexible cropping methods. This solution is ideal for image editing, border removal, content focusing, thumbnail creation, web optimization, social media preparation, and automated cropping workflows that require precise area selection with professional output and seamless integration.
Setup
Add the PDF4me "Crop Image" node to your n8n workflow and configure the required parameters. For initial setup instructions, see our n8n Integration Guide.
Prerequisites:
- PDF4me API credentials
- n8n workflow access
Configuration:
- Add PDF4me node to workflow
- Select "Crop Image" action
- Configure input parameters (see below)

Parameters
Complete list of parameters for the Crop Image action. Configure these parameters to control image cropping.
Important: Parameters marked with an asterisk (***) are required and must be provided for the action to function correctly.
| Parameter | Type | Description | Example |
|---|---|---|---|
| Input Data Type | String | Yes | PDF4me image input format selection Choose the format of your source image data input. PDF4me supports multiple input types with different field requirements |
| 1) Binary Data | Yes (One Required) | 1) Binary Data - Use "Input Binary Field" to reference image file from previous node | |
| 2) Base64 String | Yes (One Required) | 2) Base64 String - Use "Base64 Image Content" field for encoded image data | |
| 3) URL | Yes (One Required) | 3) URL - Use "Image URL" field to provide a public/open permission URL to the image file to crop | |
| Input Binary Field | Binary | Yes (If Binary Data) | PDF4me binary image file input - Reference source image file (.jpg, .png, .gif, .bmp) from previous n8n node or file upload. PDF4me processes binary image files with automatic format detection and validation. Required when Input Data Type is "Binary Data" |
| Base64 Image Content | String | Yes (If Base64 String) | PDF4me base64 encoded image input - Provide source image data (.jpg, .png, .gif, .bmp) as base64 encoded string for secure transmission. PDF4me automatically decodes and processes the image content. Required when Input Data Type is "Base64 String" |
| Image URL | String | Yes (If URL) | PDF4me public image URL input - Provide a public/open permission URL to the source image file (.jpg, .png, .gif, .bmp) to be cropped. PDF4me downloads and processes the file from the provided URL. Required when Input Data Type is "URL" |
| Output File Name | String | Yes | PDF4me output filename configuration - Specify the name for the generated cropped image file with proper extension (.jpg, .png, .gif, .bmp). This is an input parameter that configures what the output file will be named. PDF4me ensures unique naming and validates file format compliance |
| Document Name | String | Yes | PDF4me source document identifier - Specify a name for the source image document for reference and tracking purposes. This helps identify the document in logs and processing workflows |
| Crop Type | String | Yes | PDF4me cropping method selection - Choose the cropping method for image processing. Options include border cropping for automatic edge detection or custom cropping for manual specifications |
| Border | Yes (One Required) | Border Cropping - Crop by removing borders from all sides. Specify exact pixel values for left, right, top, and bottom margins to remove unwanted borders or whitespace | |
| Rectangle | Yes (One Required) | Rectangle Cropping - Crop using rectangular coordinates. Specify the upper-left corner position and dimensions to create a precise rectangular crop area | |
| Border Cropping Options | Object | No | PDF4me border margin configuration - Configure specific pixel values for removing borders from each side of the image. Set individual margins for left, right, top, and bottom borders to achieve precise cropping results |
| Left Border | Number | No | PDF4me left border margin - Specify the number of pixels to remove from the left side of the image. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Right Border | Number | No | PDF4me right border margin - Specify the number of pixels to remove from the right side of the image. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Top Border | Number | No | PDF4me top border margin - Specify the number of pixels to remove from the top side of the image. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Bottom Border | Number | No | PDF4me bottom border margin - Specify the number of pixels to remove from the bottom side of the image. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Rectangle Cropping Options | Object | No | PDF4me rectangle coordinate configuration - Configure precise rectangular crop area using coordinate-based positioning. Set the upper-left corner position and dimensions to define the exact crop region |
| Upper Left X | Number | No | PDF4me upper-left X coordinate - Specify the X coordinate (horizontal position) of the upper-left corner of the crop rectangle. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Upper Left Y | Number | No | PDF4me upper-left Y coordinate - Specify the Y coordinate (vertical position) of the upper-left corner of the crop rectangle. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Width | Number | No | PDF4me crop rectangle width - Specify the width of the crop rectangle in pixels. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Height | Number | No | PDF4me crop rectangle height - Specify the height of the crop rectangle in pixels. Use Fixed mode for static values or Expression mode for dynamic calculations |
| Output Binary Field Name | String | Yes | PDF4me output variable configuration - Define the variable name for accessing the generated cropped image binary data in your n8n workflow. This binary data can be used as input data in subsequent actions within your workflow |
| Advanced Options | Object | No | PDF4me advanced configuration settings - Configure advanced processing options and custom profiles for enhanced image cropping capabilities. Leave empty for default settings or specify custom parameters for optimized processing |
| Custom Profiles | Object | No | PDF4me custom profile configuration - Define custom processing profiles with specific output data formats and processing parameters. Use this for specialized cropping requirements and custom output formats |
Supported Image Formats
| Format | Description | File Extensions | Max Size | Best Use Cases |
|---|---|---|---|---|
| JPEG | Joint Photographic Experts Group with lossy compression optimized for photographs | .jpg, .jpeg | 50MB | Photographs, complex images, web content, social media |
| PNG | Portable Network Graphics with lossless compression and transparency support | .png | 50MB | Graphics with transparency, logos, screenshots, web graphics |
| GIF | Graphics Interchange Format with animation support and limited color palette | .gif | 50MB | Animated images, simple graphics, web animations |
| BMP | Bitmap image format with uncompressed pixel data | .bmp | 50MB | High-quality images, professional graphics, archival purposes |
Output
Output Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| fileName | String | PDF4me generated cropped image filename - The complete filename of the successfully cropped image with proper extension. PDF4me ensures unique naming and validates file format compliance for seamless integration with downstream processes | cropped_image.jpg |
| fileSize | Number | PDF4me cropped image file size in bytes - The exact size of the generated cropped image file in bytes, provided by PDF4me for storage planning, bandwidth optimization, and file transfer monitoring. Essential for enterprise image management and workflow automation | 125430 |
| originalFileSize | Number | PDF4me original file size in bytes - The size of the original image file before cropping, provided for comparison and optimization tracking | 245760 |
| cropDimensions | Object | PDF4me crop area specifications - Object containing the exact crop area dimensions and coordinates used for the cropping operation. Includes width, height, x-coordinate, and y-coordinate of the cropped region | {"width": 800, "height": 600, "x": 100, "y": 50} |
| success | Boolean | PDF4me cropping status indicator - Boolean flag indicating the success or failure of the image cropping process. PDF4me returns true for successful operations and false for any errors, enabling robust error handling in automated workflows | true |
| mimeType | String | PDF4me output MIME type - MIME type of the generated cropped image file (e.g., "image/jpeg", "image/png"). Useful for content type validation and proper file handling in web applications | image/jpeg |
| message | String | PDF4me cropping status message - Human-readable status message providing details about the image cropping process result. Includes success confirmation or error details for troubleshooting | Image cropped successfully |
N8N Action Response
The PDF4me Crop Image API returns a response that can be viewed in multiple formats. Choose the view that best fits your needs:
- JSON
- Table
- Schema
- Binary
JSON Response Format
The raw JSON response from the API:
[
{
"success": true,
"message": "Image cropped successfully",
"fileName": "cropped_image.jpg",
"mimeType": "image/jpeg",
"fileSize": 125430,
"originalFileSize": 245760,
"cropDimensions": {
"width": 800,
"height": 600,
"x": 100,
"y": 50
}
}
]
Table View
Response data in a structured table format:
| Parameter | Value |
|---|---|
| success | true |
| message | Image cropped successfully |
| fileName | cropped_image.jpg |
| mimeType | image/jpeg |
| fileSize | 125430 |
| originalFileSize | 245760 |
| cropDimensions | {"width": 800, "height": 600, "x": 100, "y": 50} |
Schema View
The data structure and types of the response:
1 item
success: ☑ true
message: AB Image cropped successfully
fileName: AB cropped_image.jpg
mimeType: AB image/jpeg
fileSize: # 125430
originalFileSize: # 245760
cropDimensions: {} width: # 800, height: # 600, x: # 100, y: # 50
Type Indicators:
AB= String#= Number☑= Boolean{}= Object
Binary Data View
The actual cropped image file data and metadata:
data
─────────────────────────────
File Name: cropped_image.jpg
File Extension: jpg
Mime Type: image/jpeg
File Size: 122.5 KB
Crop Dimensions: 800x600
Original Size: 245.8 KB
Binary Data Access:
- n8n Binary Object:
$binary.data.data - Base64 Content: Available for direct use
- File Operations: Ready for download, email, or storage
Use Cases
Content Marketing and Social Media
- Crop product images to focus on key features and improve visual appeal
- Optimize images for different social media platforms with specific aspect ratios
- Remove unwanted backgrounds or borders from marketing materials
E-commerce and Product Management
- Standardize product image dimensions across online catalogs
- Remove watermarks or unwanted elements from product photos
- Create consistent thumbnail images for product listings
Document and Image Processing
- Remove borders and whitespace from scanned documents
- Crop screenshots to focus on specific interface elements
- Optimize images for web display by removing unnecessary areas