Skip to main content

AILabTools API - Age & Gender swap - API

Request

  • URL: https://www.ailabapi.com/api/portrait/effects/face-attribute-editing
  • Method: POST
  • Content-Type: multipart/form-data

Image requirements

  • Image format: JPEG JPG PNG BMP
  • Image size: No more than 4 MB.
  • Image resolution: Larger than 256x256px, smaller than 4096x4096px. The face area must be 64x64px or more.
FieldRequiredTypeDescription
ailabapi-api-keyYESstringApplication API KEY.

Body

Fixed Fields

FieldRequiredTypeScopeDefaultExampleDescription
imageYESfile
action_typeYESstring
  • TO_KID
  • TO_OLD
  • TO_FEMALE
  • TO_MALE
  • V2_AGE
  • V2_GENDER
  • Face editing method.
  • TO_KID: V1 version becomes a child.
  • TO_OLD: V1 version becomes old man.
  • TO_FEMALE: V1 version becomes girls.
  • TO_MALE: V1 version becomes boys.
  • V2_AGE: V2 version age change.
  • V2_GENDER: v2 version gender shift.
  • quality_controlNOstring
  • NONE
  • LOW
  • NORMAL
  • HIGH
  • NONEImage quality (image field image quality).
    Please select the appropriate option based on quality information such as masking, lighting, blurriness, and integrity of the face.
    If selecting a higher quality causes the image to be unprocessable, please select a lower quality to try.
  • NONE: No control is performed.
  • LOW: Lower quality requirements.
  • NORMAL: General quality requirements.
  • HIGH: Higher quality requirements.
  • face_locationNOjson string{"left":111.4,"top":96.56,"width":98,"height":98,"rotation":3}When multiple faces are detected in the image, use this parameter to specify the position of the face to be edited in the image, or default to the largest face in the image if not specified.

    action_type === V2_AGE

    FieldRequiredTypeScopeDescription
    targetYESinteger[1, 85]Age.

    action_type === V2_GENDER

    FieldRequiredTypeScopeDescription
    targetYESinteger
  • 0
  • 1
  • Gender.
  • 0: Male.
  • 1: Female.
  • 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.
    +imagestringThe BASE64 value of the edited image.

    Example

    {
    "error_code": 0,
    "error_code_str": "",
    "error_msg": "",
    "request_id": "",
    "log_id": "",
    "data": {
    "image": ""
    }
    }

    Code example

    If you'd like to see the actual effects, please visit the experience page for a trial.