Skip to main content
POST
/
api
/
image
/
editing
/
intelligent-composition
Intelligent Composition
curl --request POST \
  --url https://www.ailabapi.com/api/image/editing/intelligent-composition \
  --header 'Content-Type: multipart/form-data' \
  --header 'ailabapi-api-key: <api-key>' \
  --form 'num_boxes=<string>' \
  --form image=@example-file
{
  "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
      }
    ]
  }
}

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.

Headers

FieldRequiredTypeDescription
ailabapi-api-keyYESstringApplication API KEY. Get API KEY

Body

FieldRequiredTypeScopeDefaultDescription
imageYESfile
num_boxesNOinteger1, 2, 3, 4, 5, 6, 7, 8, 9, 105The number of output boxes.

Response

Response Field Handling Flow
  1. Handle Public Response Fields Parse and validate the Public Response Fields, checking the status code or response message to ensure the request is successful and error-free.
  2. Handle Business Response Fields If the Public Response Fields are valid and error-free, proceed with processing the business logic in the Business Response Fields.

Public Response Fields

Viewing Public Response Fields and Error Codes

Business Response Fields

FieldTypeDescription
dataobjectThe content of the result data returned.
+elementsarrayIntelligent composition results.
++min_xintegerThe horizontal coordinate of the upper-left corner of the output box.
++max_xintegerThe horizontal coordinate of the lower-right corner of the output box.
++min_yintegerThe vertical coordinate of the upper-left corner of the output box.
++max_yintegerThe lower-right vertical coordinate of the output box.
++scorefloatThe 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
      }
    ]
  }
}

Sample Code

Authorizations

ailabapi-api-key
string
header
required

API Key for authentication

Body

multipart/form-data
image
file
num_boxes
string

The number of output boxes.

Response

200 - application/json

Success

The response is of type object.