Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Age & Gender swap API

Request

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.

Body

Fixed Fields

FieldRequiredTypeScopeDefaultDescription
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.
  • More Details
    face_locationNOjson stringWhen 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. More Details

    action_type === V2_AGE

    FieldRequiredTypeScopeDescription
    targetYESinteger[1, 85]Age.

    action_type === V2_GENDER

    FieldRequiredTypeScopeDescription
    targetYESinteger
  • 0
  • 1
  • Gender.
  • 0: Male.
  • 1: Female.
  • quality_control

    The quality control thresholds corresponding to different control systems: If any quality information detected does not meet the requirements of the control threshold, an error will be returned.

    quality_control = LOWquality_control = NORMALquality_control = HIGHScopeDescription
    0.80.60.2[0, 1]The proportion of the left eye being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the right eye being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the nose being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the mouth being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the left cheek being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the right cheek being obscured. 1 indicates complete obstruction.
    0.80.60.2[0, 1]The proportion of the chin being obscured. 1 indicates complete obstruction.
    2040100[0, 255]Lighting. 0 indicates poor lighting.
    0.80.60.2[0, 1]Image blur. 1 indicates complete blur.
    001
  • 0
  • 1
  • Completeness of the face.
  • 0: The face overflows the image boundaries.
  • 1: The entire face is within the image boundaries.
  • 453020[-90 (left), 90 (right)]Left-right rotation angle in three-dimensional rotation. A threshold of 30 indicates that the absolute value of the angle must be within 30.
    453020[-180 (counterclockwise), 180 (clockwise)]Rotation angle within the plane. A threshold of 30 indicates that the absolute value of the angle must be within 30.
    453020[-90 (up), 90 (down)]Pitch angle in three-dimensional rotation. A threshold of 30 indicates that the absolute value of the angle must be within 30.

    face_location

    • Request Example

      {"left":111.4,"top":96.56,"width":98,"height":98,"rotation":3}

    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
    resultobjectThe content of the result data returned.
    +imagestringThe BASE64 value of the edited image.

    Response Example

    {
    "request_id": "",
    "log_id": "",
    "error_code": 0,
    "error_msg": "",
    "error_detail": {
    "status_code": 200,
    "code": "",
    "code_message": "",
    "message": ""
    },
    "result": {
    "image": ""
    }
    }