Skip to main content

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:

  1. Add PDF4me node to workflow
  2. Select "Crop Image" action
  3. Configure input parameters (see below)
Crop Image

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.

ParameterTypeDescriptionExample
Input Data TypeStringYesPDF4me image input format selection
Choose the format of your source image data input.
PDF4me supports multiple input types with different field requirements
1) Binary DataYes (One Required)1) Binary Data - Use "Input Binary Field" to reference image file from previous node
2) Base64 StringYes (One Required)2) Base64 String - Use "Base64 Image Content" field for encoded image data
3) URLYes (One Required)3) URL - Use "Image URL" field to provide a public/open permission URL to the image file to crop
Input Binary FieldBinaryYes (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 ContentStringYes (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 URLStringYes (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 NameStringYesPDF4me 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 NameStringYesPDF4me 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 TypeStringYesPDF4me cropping method selection - Choose the cropping method for image processing. Options include border cropping for automatic edge detection or custom cropping for manual specifications
BorderYes (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
RectangleYes (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 OptionsObjectNoPDF4me 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 BorderNumberNoPDF4me 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 BorderNumberNoPDF4me 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 BorderNumberNoPDF4me 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 BorderNumberNoPDF4me 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 OptionsObjectNoPDF4me 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 XNumberNoPDF4me 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 YNumberNoPDF4me 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
WidthNumberNoPDF4me crop rectangle width - Specify the width of the crop rectangle in pixels. Use Fixed mode for static values or Expression mode for dynamic calculations
HeightNumberNoPDF4me 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 NameStringYesPDF4me 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 OptionsObjectNoPDF4me 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 ProfilesObjectNoPDF4me 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

FormatDescriptionFile ExtensionsMax SizeBest Use Cases
JPEGJoint Photographic Experts Group with lossy compression optimized for photographs.jpg, .jpeg50MBPhotographs, complex images, web content, social media
PNGPortable Network Graphics with lossless compression and transparency support.png50MBGraphics with transparency, logos, screenshots, web graphics
GIFGraphics Interchange Format with animation support and limited color palette.gif50MBAnimated images, simple graphics, web animations
BMPBitmap image format with uncompressed pixel data.bmp50MBHigh-quality images, professional graphics, archival purposes

Output

Output Parameters

ParameterTypeDescriptionExample
fileNameStringPDF4me 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 processescropped_image.jpg
fileSizeNumberPDF4me 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 automation125430
originalFileSizeNumberPDF4me original file size in bytes - The size of the original image file before cropping, provided for comparison and optimization tracking245760
cropDimensionsObjectPDF4me 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}
successBooleanPDF4me 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 workflowstrue
mimeTypeStringPDF4me 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 applicationsimage/jpeg
messageStringPDF4me cropping status message - Human-readable status message providing details about the image cropping process result. Includes success confirmation or error details for troubleshootingImage 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 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
}
}
]

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

Get Help