Image Translation Standard Version API Reference

Image Translation

GET/POST /ai/image/translation

Image Translation is specially designed for e-commerce images, supporting 198 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.

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

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

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. After receiving the returned ID, you can call image translation data for editing API to get the complete parameter information.

Sample: false

translatingBrandInTheProduct

Boolean

No

Choose whether to translate brand names in images. This can help you protect brand name information and avoid translation.

Default: false (which means brand names will not be translated)

Sample Request

IopClient client = new IopClientImp(url, appkey, appSecret);
IopRequest request = new IopRequest();
// Adding this trial tag in header means using the trial resource to test, 
// request.addHeaderParameter("x-iop-trial","true")
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 Discord or email us (aidgesales@alibaba-inc.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 Discord or email us (aidgesales@alibaba-inc.com) for troubleshooting.

900

tpp url error

Internal call exception, please contact us via Discord or email us (aidgesales@alibaba-inc.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 Discord or email us (aidgesales@alibaba-inc.com).

1002

content risk filter failed, please contact us

Content risk filter failed, please contact us via Discord or email us (aidgesales@alibaba-inc.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 Discord or email us (aidgesales@alibaba-inc.com).

The Image Translation Standard version supports source language to:

Language

Language Code

Chinese(Simplified)

zh

English

en

French

fr

Italian

it

Japanese

ja

Korean

ko

Portuguese

pt

Spanish

es

Turkish

tr

The Image Translation Standard version supports target language to:

Language

Language Code

Arabic

ar

Bengali

bn

Chinese(Simplified)

zh

Chinese (Traditional) only Chinese(Simplified) and English as source languages are supported

zh-tw

Czech only English and Turkish as source languages are supported

cs

Dutch

nl

English

en

French

fr

German

de

Greek only English and Turkish as source languages are supported

el

Hebrew

he

Hungarian only English and Turkish as source languages are supported

hu

Indonesian

id

Italian

it

Japanese

ja

Kazakh only Chinese as source language is supported

kk

Korean

ko

Malay

ms

Polish

pl

Portuguese

pt

Russian

ru

Spanish

es

Thai

th

Turkish

tr

Ukrainian

uk

Urdu

ur

Vietnamese

vi

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.

Last updated

Was this helpful?