Skip to main content

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.
FieldRequiredTypeDescription
ailabapi-api-keyYESstringApplication API KEY.

Body

FieldRequiredTypeScopeDefaultsDescription
imageYESfile
num_boxesNOinteger
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 5The number of output boxes.

    Response

    Parameters

    FieldTypeDescription
    error_codeintegerStatus Code.
    error_code_strstringError Code.
    error_msgstringError Message.
    request_idstringRequest ID.
    log_idstringLog ID.
    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.

    Example

    {
    "error_code": 0,
    "error_code_str": "",
    "error_msg": "",
    "request_id": "",
    "log_id": "",
    "data": {
    "elements": [
    {
    "min_x": 0,
    "max_x": 0,
    "min_y": 0,
    "max_y": 0,
    "score": 0
    }
    ]
    }
    }

    Code example