AI Image Cropping
AI Image Cropping
AI Image Cropping API
AI Image Cropping API detects the main subject and crops images to target dimensions for thumbnails, layouts, and visual assets.
POST
AI Image Cropping
Request
- URL:
https://www.ailabapi.com/api/image/editing/image-cropping - Method:
POST - Content-Type:
multipart/form-data
Image requirements
- Image format:
JPEGJPGPNGBMPWEBP - Image size: No more than 3.5 MB.
- Image resolution: Less than 2000x2000px.
- The images must all be RGB 3-channel.
Headers
| Field | Required | Type | Description |
|---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. Get API KEY |
Body
| Field | Required | Type | Description |
|---|---|---|---|
image | YES | file | |
width | YES | integer | The width of the target. Unit: px. |
height | YES | integer | The height of the target. Unit: px. |
Response
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| Field | Type | Description |
|---|---|---|
data | object | The content of the result data returned. |
+url | string | The URL address of the image after size transformation. |
+retain_location | object | The coordinate information of the original image data in the generated image. |
++width | integer | Outputs the width of the original image after isoscaling according to the specified width. Unit: px. |
++height | integer | Outputs the height of the original image after isoscaling according to the specified height. Unit: px. |
++y | integer | The y-coordinate of the upper-left corner of the original figure. |
++x | integer | The x coordinate of the upper left corner of the original figure. |

