AILabTools API - Intelligent Composition - API
draft: true
Important Announcement: The API Documentation Has Been Fully Updated
This API documentation has been completely restructured with an improved and clearer format. The current page will no longer receive active updates or maintenance. For the most accurate and up-to-date information, please switch to the new documentation.
View New DocsRequest
- URL:
https://www.ailabapi.com/api/image/editing/intelligent-composition - Method:
POST - Content-Type:
multipart/form-data
Image requirements
- Image format:
JPEGJPGPNGBMPWEBP - Image size: No more than 3 MB.
- Image resolution: Larger than 32x32px, smaller than 4096x4096px.
Headers
| Field | Required | Type | Description |
|---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. Get API KEY |
Body
| Field | Required | Type | Scope | Default | Description |
|---|---|---|---|---|---|
image | YES | file | |||
num_boxes | NO | integer | 12345678910 | 5 | The number of output boxes. |
Response
Response Field Handling Flow
-
Handle
Public Response FieldsParse and validate the
Public Response Fields, checking the status code or response message to ensure the request is successful and error-free. -
Handle
Business Response FieldsIf the
Public Response Fieldsare valid and error-free, proceed with processing the business logic in theBusiness Response Fields.
Public Response Fields
Viewing Public Response Fields and Error CodesBusiness Response Fields
| Field | Type | Description |
|---|---|---|
data | object | The content of the result data returned. |
+elements | array | Intelligent composition results. |
++min_x | integer | The horizontal coordinate of the upper-left corner of the output box. |
++max_x | integer | The horizontal coordinate of the lower-right corner of the output box. |
++min_y | integer | The vertical coordinate of the upper-left corner of the output box. |
++max_y | integer | The lower-right vertical coordinate of the output box. |
++score | float | The higher the score, the better the composition. 3.8 or above is recommended as a better composition score. |
Response Example
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_msg": "",
"error_detail": {
"status_code": 200,
"code": "",
"code_message": "",
"message": ""
},
"data": {
"elements": [
{
"min_x": 0,
"max_x": 0,
"min_y": 0,
"max_y": 0,
"score": 0
}
]
}
}