Image Translation API Reference

Image Translation

GET/POST /ai/image/translation

Image Translation is specially designed for e-commerce images, supporting at least 18 languages. It accurately handles complex text layouts within images and ensures that the translated content matches the image content. This helps e-commerce platforms and developers easily achieve multilingual conversion and presentation of image content.

Request Parameter

Parameter
Type
Required
Description

imageUrl

String

Yes

Source image URL

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

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

translatingTextInTheProduct

Boolean

No

Choose whether to translate the text within the main subject of images; this allows you to protect 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

Sample: false

Sample Request

IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("/ai/image/translation");
request.addApiParameter("imageUrl", "https://ae01.alicdn.com/kf/S68468a838ad04cc081a4bd2db32745f1y/M3-Light-emitting-Bluetooth-Headset-Folding-LED-Card-Wireless-Headset-TYPE-C-Charging-Multi-scene-Use.jpg_.webp");
request.addApiParameter("sourceLanguage", "en");
request.addApiParameter("targetLanguage", "fr");
request.addApiParameter("translatingTextInTheProduct", "false");
request.addApiParameter("useImageEditor", "false");
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 image URL of the translation result.

data.imageEditorId

String

The parameter protocol query ID required by the image editor (exposed when the request parameter useImageEditor is set to true).

requestId

String

Request ID;Used to identify a unique 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": {
    "imageUrl": "https://nhci-image.oss-ap-southeast-1.aliyuncs.com/tufan%2F512506ce-32a5-11ef-9dd3-00163e08a26f.png?OSSAccessKeyId=LTAI5tCv9DpB7gYic1oGsAyv&Expires=4935959108&Signature=vf2a7lOn8uvvsfDfyeJNiYMls9Y%3D"
  },
  "requestId": "2140c5a117192871068067414ee3ad",
  "success": true,
  "resCode": 200,
  "resMessage": "success",
  "code": "0",
  "request_id": "2140cc8017192871068088228",
  "_trace_id_": "2140c5a117192871068067414ee3ad"
}

Errors

Error Code
Error Message
Description

501

rate limit exceed

The current interface has reached the current limit. Please contact us via navigation bar or email us (aidge_support@service.alibaba.com) 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 limit

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 navigation bar or email us (aidge_support@service.alibaba.com) for troubleshooting.

900

tpp url error

Internal call exception, please contact us via navigation bar or email us (aidge_support@service.alibaba.com) 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 navigation bar or email us (aidge_support@service.alibaba.com).

1002

content risk filter failed, please contact us

Content risk filter failed, please contact us via navigation bar or email us (aidge_support@service.alibaba.com).

Appendix

Supported Language Pairs

The image translation API supports translation between the language pairs listed in the following table. More language pairs are continuously being added. Please contact us via navigation bar or email us (aidge_support@service.alibaba.com).

Source Language
Target Language

Chinese (Simplified)

Arabic

Chinese (Simplified)

Chinese (Traditional)

Chinese (Simplified)

English

Chinese (Simplified)

French

Chinese (Simplified)

Japanese

Chinese (Simplified)

Korean

Chinese (Simplified)

Portuguese (Portugal)

Chinese (Simplified)

Russian

Chinese (Simplified)

Spanish

Chinese (Simplified)

Vietnamese

Chinese (Simplified)

Thai

Chinese (Simplified)

Indonesia

Chinese (Simplified)

German

Chinese (Simplified)

Polish

Chinese (Simplified)

Dutch

Chinese (Simplified)

Italian

Chinese (Simplified)

Turkish

Chinese (Simplified)

Hebrew

English

Arabic

English

Chinese (Traditional)

English

Chinese (Simplified)

English

Vietnamese

English

French

English

Japanese

English

Korean

English

Portuguese (Portugal)

English

Russian

English

Spanish

English

Thai

English

Indonesia

English

German

English

Polish

English

Dutch

English

Italian

English

Turkish

English

Hebrew

Turkish

Arabic

Turkish

English

Language Code

The language code uses ISO 639-1 two-digit language codes. For a country/region variant of a language, the table follows the RFC 5646 format of appending a dash followed by an ISO 3166 2-digit country code. For example, the language code for Traditional Chinese is zh-tw.

Language
Language Code

Arabic

ar

Chinese (Simplified)

zh

Chinese (Traditional)

zh-tw

English

en

French

fr

Japanese

ja

Korean

ko

Portuguese (Portugal)

pt

Russian

ru

Spanish

es

Turkish

tr

Hebrew

he

Vietnamese

vi

Thai

th

Indonesia

id

German

de

Polish

pl

Dutch

nl

Italian

it

Last updated