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.
Header
Field | Required | Type | Description |
---|---|---|---|
ailabapi-api-key | YES | string | Application API KEY. |
Body
Fixed Fields
Field | Required | Type | Scope | Default | Example | Description |
---|---|---|---|---|---|---|
image | YES | file | ||||
action_type | YES | string | 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_control | NO | string | NONE LOW NORMAL HIGH | NONE | Image 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_location | NO | json 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
Field | Required | Type | Scope | Description |
---|---|---|---|---|
target | YES | integer | [1, 85] | Age. |
action_type
=== V2_GENDER
Field | Required | Type | Scope | Description |
---|---|---|---|---|
target | YES | integer | 0 1 | Gender. 0 : Male.1 : Female. |
Response
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. |
+image | string | The 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.