AILabTools API - Intelligent Composition - API
Request
- URL:
https://www.ailabapi.com/api/image/editing/intelligent-composition
- Method:
POST
- Content-Type:
multipart/form-data
Image requirements
- Image format:
JPEG
JPG
PNG
BMP
WEBP
- Image size: No more than 3 MB.
- Image resolution: Larger than 32x32px, smaller than 4096x4096px.
Header
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 | 1 2 3 4 5 6 7 8 9 10 | 5 | The number of output boxes. |
Response
Processing Flow
-
Handle
Public Parameters
:First, parse and validate the
Public Parameters
, checking the status code or response message to ensure the request is successful and no errors are present. -
Handle
Business Parameters
:If the public parameters are valid and no exceptions are found, proceed to process the business logic in the
Business Parameters
.
Public Parameters
Viewing Public Parameters and Error CodesBusiness Parameters
Field | Type | Description |
---|---|---|
error_code | integer | Status Code. |
error_code_str | string | Error Code. |
error_msg | string | Error Message. |
request_id | string | Request ID. |
log_id | string | Log ID. |
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. |
Example
{
"request_id": "",
"log_id": "",
"error_code": 0,
"error_code_str": "",
"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
}
]
}
}