Image Translation Pro Version API Synchronous Interface

lation Pro Version API Synchronous Interface

GET/POST/ai/image/translation_mllm

Product description

The Image Translation Pro product is specifically designed for e-commerce images, integrating multimodal large model technology to achieve a more accurate understanding of images. It significantly improves translation quality and continues to expand and optimize multilingual translation capabilities.

Request Parameter

Parameter

Type

Required

Description

imageUrl

String

Yes

Image requirements:No more than 4000x4000 pixel. Size up to 10MB. Supporting png, jpeg, jpgm, bmp, webp.

Sample: http://example.jpg/

sourceLanguage

String

Yes

Source language code. Supporting languages as the appendix shows.

Sample: en

targetLanguage

String

Yes

Target language code. Supporting languages as the appendix shows.

Sample: ko

includingProductArea

Boolean

No

Choose whether to translate the text within the main subject of images; this allows you to preserve and avoid translating embedded information such as product names.

As shown in the example image, the text in the red box represents the text on the main subject, while the text in the blue box represents text not on the main subject.

Sample: false

useImageEditor

Boolean

No

Whether it return layout information such as the position, font, and color of the text. This is used to obtain data for secondary editing when integrating with the image editor.

Sample: false

translatingBrandInTheProduct

Boolean

No

Choose whether to translate brand names on the image. This can help you preserve brand name information and prevent it from being translated.

Default:false(This means not translating the brand name.)

As shown in the example image,“懒角落”refers to a brand name

Sample:"false"

Sample Request

  • For other programming languages, please refer to Quick Start.

IopClient client = new IopClientImpl(url, appkey, appSecret);
        IopRequest request = new IopRequest();
        request.setApiName("/ai/image/translation_mllm");
// If you have not purchased a formal quota, please add a trial flag; otherwise, you will receive a NoResource error code.
// request.addHeaderParameter("x-iop-trial","true");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("imageUrl", "https://img.alicdn.com/imgextra/i1/1955749012/O1CN016P3Jas2GRY7vaevsK_!!1955749012.jpg");
        jsonObject.put("sourceLanguage", "zh");
        jsonObject.put("targetLanguage", "en");
        jsonObject.put("translatingBrandInTheProduct", "false");
        jsonObject.put("useImageEditor", "false");
        request.addApiParameter("paramJson", jsonObject.toString());
        IopResponse response = client.execute(request);
        System.out.println(response.getBody());
        Thread.sleep(10);

Response Parameters

Parameter

Type

Description

resCode

Number

Response code;200 indicates a successful call. For other response codes,please refer to the error code information.

data

Object

Result data that generated.

data.imageUrl

String

The URL of the image generated after the image translation results.

data.imageEditorId

String

Parameter required for image editor ''Protocol Query ID'' (the ID must be provided when the request parameter useImageEditor is set to true)

requestId

String

Request ID: Used to uniquely identify a single request call.

success

Boolean

Whether successful;true is successful,false is unsuccessful.

resMessage

String

Error message,e.g. "content has sensitive data, please try other input".

Sample Response

{
  "data": {
    "usage": 1,
    "result": {
      "data": {
        "message": [],
        "usageMap": "{\"usage\":1}",
        "structData": {
          "message": [
            {
              "edit_info": {
                "goodsRects": {
                  "top": 0,
                  "left": 0,
                  "width": 749,
                  "height": 872
                },
                "languages": [
                  "en"
                ],
                "resultImageIds": [
                  "34148e96-429f-11f0-8340-00163e1272a3"
                ],
                "textAreas": [
                  {
                    "horizontalLayout": "center",
                    "verticalLayout": "center",
                    "color": "#000000",
                    "texts": [
                      {
                        "valid": true,
                        "horizontalLayout": "center",
                        "verticalLayout": "center",
                        "color": "#070604",
                        "ovis_err_msg": "| ovis time: 1.481",
                        "imageRect": {
                          "top": 120,
                          "left": 33,
                          "width": 496,
                          "degree": 0,
                          "height": 82
                        },
                        "fontsize": 38,
                        "language": "en",
                        "value": "Hilton Hotel Soft Mattress",
                        "textRect": {
                          "top": 136,
                          "left": 44,
                          "width": 474,
                          "degree": 0,
                          "height": 50
                        },
                        "trans_model_name": "MarcoVL2-8B-PicTrans",
                        "lineCount": 1
                      }
                    ],
                    "fontsize": 50,
                    "content": "希尔顿酒店软床垫",
                    "lineCount": 1
                  },
                  {
                    "horizontalLayout": "left",
                    "verticalLayout": "center",
                    "color": "#000000",
                    "texts": [
                      {
                        "valid": true,
                        "horizontalLayout": "center",
                        "verticalLayout": "center",
                        "color": "#504d48",
                        "ovis_err_msg": "| ovis time: 1.481",
                        "imageRect": {
                          "top": 205,
                          "left": 99,
                          "width": 331,
                          "degree": 0,
                          "height": 58
                        },
                        "fontsize": 28,
                        "language": "en",
                        "value": "Scientifically Blended Cotton Fabric",
                        "textRect": {
                          "top": 217,
                          "left": 23,
                          "width": 484,
                          "degree": 0,
                          "height": 34
                        },
                        "trans_model_name": "MarcoVL2-8B-PicTrans",
                        "lineCount": 1
                      }
                    ],
                    "fontsize": 35,
                    "content": "全棉面料科学配比",
                    "lineCount": 1
                  }
                ],
                "repairedUrl": "https://aib-image.oss-ap-southeast-1.aliyuncs.com/tufan%2F333084ee-429f-11f0-b032-00163e1272a3.png?OSSAccessKeyId=LTAI5tSEGjGp5wixZgHLc3bV&Expires=4965863197&Signature=KWiuBsDlV89BgCPschjiKuZkEKY%3D",
                "font": [
                  "AlibabaSans-Regular"
                ]
              },
              "src_image": "https://img.alicdn.com/imgextra/i1/1955749012/O1CN016P3Jas2GRY7vaevsK_!!1955749012.jpg",
              "result_list": [
                {
                  "fileUrl": "https://aib-image.oss-ap-southeast-1.aliyuncs.com/tufan%2F342bd452-429f-11f0-8340-00163e1272a3.jpg?OSSAccessKeyId=LTAI5tSEGjGp5wixZgHLc3bV&Expires=4965863199&Signature=xVFKFzxbdNdOW1d9IaZziqpukGA%3D",
                  "language": "en"
                }
              ]
            }
          ],
          "usageMap": "{\"usage\": 1}"
        }
      },
      "success": true,
      "requestId": "2166434317491911949008870e0da8"
    }
  },
  "resCode": 200,
  "resMessage": "success",
  "code": "0",
  "request_id": "2151fa1917491911951054017",
  "_trace_id_": "2166434317491911949008870e0da8"
}

Errors

Error

Code

Error Message

Description

501

rate limit exceed

The current interface has reached the current limit. Please contact us via Discord or email us ([email protected]) to increase the current limit value.

700

invalid input

The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.

703

image size exceeds the limit

The image size in the request parameters exceeds the limit; the dimensions of the image must not exceed 4000x4000 pixels.

704

invalid image form

The image format in the request parameters is invalid.

705

image file size exceeds the

The image size in the request parameters exceeds the limit; the image size must not exceed 10MB.

801

model failed

Internal call exception,please contact us via Discord or email us ([email protected]) for troubleshooting.

900

tpp url error

Internal call exception,please contact us via Discord or email us ([email protected]) for troubleshooting.

1000

content has sensitive data, please try other input

Content has sensitive data, please try other input.

1001

content control failed, please retry

Content control failed, please retry. If the error persists,please contact us via Discord or email us ([email protected]).

1002

content risk filter failed, please contact us

Content risk filter failed. Please contact us via Discord or email us ([email protected]).

Last updated

Was this helpful?