Image translation-standard edition
Translates text in images while preserving the original layout. This service uses a synchronous call to return the translated image's URL. You can also enable the editor protocol by setting UseImageEditor to true to retrieve layer information such as text position, font, and color. For higher translation quality and automatic source language detection, use Image Translation-Pro Edition.
Overview
The Image Translation service is designed specifically for e-commerce images and supports over 400 language pairs. It accurately handles complex text layouts within images and ensures that translated content matches the visual context. This allows e-commerce platforms and developers to easily localize and display visual content for global audiences.
Use cases
Ideal for e-commerce product images, marketing materials, and other image-based content.
Features
Main product subject protection: You can choose not to translate text on the main product subject. This feature protects embedded information, such as product names, from being translated.
Brand name protection: You can choose not to translate brand names in an image. This preserves brand identity by preventing brand names from being translated.
Translation intervention: Customize translation results with a glossary. You can define rules for specific terms, such as do-not-translate (for example, ABC remains ABC), forced translation (ABC becomes DEF), and deletion (ABC becomes an empty string). This is commonly used for brand name protection. To apply these rules, pass a glossary ID in your request. A glossary can typically contain up to 100,000 entries. If you need a larger capacity, contact us.
Layer information (editor protocol): When you set
UseImageEditortotrue, the response includes additional layout details such as text position, font, and color. You can use this information for post-editing. For a complete description of the fields, see the Image Translation editor protocol.
API
With this synchronous interface, you submit an image URL with the source and target languages to directly retrieve the translated image's URL.
POST /rest/ai/image/translationQuick start
import json
data = json.dumps({
"ImageUrl": "https://example.com/product-image.jpg",
"SourceLanguage": "en",
"TargetLanguage": "ko"
})
result = make_signed_request("/rest/ai/image/translation", data)
print(result["Data"]["ImageUrl"]) # URL of the translated imageFor complete request signing instructions, SDK examples in Java, Python, and Go, and online debugging, see the Alibaba Cloud OpenAPI Developer Portal: Image Translation Standard Edition API (OpenAPI Portal).
Request parameters
Parameter | Type | Required | Description |
| String | Yes | • Image URL: The URL must be publicly accessible. • Format: PNG, JPEG, JPG, BMP, or WEBP. • Dimensions: The width and height must not exceed 4,000 pixels. • File size: The original file size must be 10 MB or less. |
| String | Yes | The source language code. For a list of supported language pairs, see Supported language pairs below. Example: |
| String | Yes | The target language code. For a list of supported language pairs, see Supported language pairs below. Example: |
| Boolean | No | Specifies whether to translate text on the main product subject. The default value is |
| Boolean | No | Specifies whether to translate brand names in the image. The default value is |
| String | No | The ID of the glossary. You must create the glossary in the console in advance and provide its ID in this parameter. If this parameter is empty, the translation results are not modified. Example: |
| Boolean | No | Specifies whether to return layout information (layer information), such as the position, font, and color of the text. If this parameter is set to |
Request example
{
"ImageUrl": "https://example.com/your-image.jpg",
"SourceLanguage": "en",
"TargetLanguage": "vi",
"IncludingProductArea": true,
"TranslatingBrandInTheProduct": true,
"Glossary": null,
"UseImageEditor": true
}Response fields
Field | Type | Description |
| String | The business status code. |
| String | The status description. The value is |
| Boolean | Indicates if the request succeeded. |
| String | The unique ID for the request. |
| String | The URL of the translated image. |
| Number | The number of images processed (usage). |
| Array[Object] | An array of editor protocols (returned only when For a complete field description, see Image Translation editor protocol. |
Editor protocol fields (Data.GenFiles)
When UseImageEditor=true, the response also returns the following fields. For more information, see Image Translation Editor Protocol.
No. | Parameter name | Data type | Description and example value |
1 |
| Array[Object] | The editor protocol information. This is returned only when |
2 |
| String | The URL of the original image. |
3 |
| Object | Detailed editor information. |
4 |
| Array[String] | A collection of global IDs for the translated images. |
5 |
| String | The URL of the image after all text has been inpainted. |
6 |
| Array[String] | A list of translated languages. |
7 |
| Array[Object] | A list of text boxes. |
8 |
| Number | The font size. |
9 |
| String | The original text before translation. |
10 |
| String | The text color, such as |
11 |
| String | Vertical alignment: |
12 |
| String | Horizontal alignment: |
13 |
| Number | The number of lines in the text box. |
14 |
| Array[Object] | A list of translated text objects. |
15 |
| Number | The font size. |
16 |
| String | The language. |
17 |
| Boolean | Indicates if the text item is valid. |
18 |
| Object | The inpainted area of the image. |
19 |
| Object | The area of the text box. |
20 |
| String | The color. |
21 |
| String | The translated text. |
22 |
| String | The vertical alignment. |
23 |
| String | The horizontal alignment. |
24 |
| Number | The number of lines in the text box. |
25 |
| Object | The product bounding box area. |
26 |
| Array[String] | The font type. |
27 |
| Array[Object] | A collection of translation results. |
28 |
| String | The translated language. |
29 |
| String | The URL of the translated image. |
Response example
{
"Data": {
"ImageUrl": "http://dashscope-a717.oss-cn-beijing.aliyuncs.com/.../7901aa74-translated.jpg",
"UsageMap": { "ProcessedImageCount": 1 }
},
"RequestId": "1CEC4D94-905A-1ED1-A7B4-1BFEFFB3D850",
"Message": "Success",
"Code": "success",
"Success": true
}Supported language pairs
Image Translation-Standard Edition supports over 400 language pairs covering 156 languages, including through bridging. For example, Traditional Chinese (zh-tw) is translated via bridging through Simplified Chinese (zh). The supported language pairs are consistent with those for text translation. For a complete list of language pairs and their codes, see Language Mapping.
Error codes
Image Translation uses a unified system of named error codes. The following are common error codes for this service:
InvalidParameter: The image width or height exceeds 4,000 pixels, the file size is over 10 MB, or the format is not in the supported list (PNG, JPEG, JPG, BMP, or WebP).DownstreamUnavailable: The image URL is inaccessible, or the service failed to download the image.InputContentBlocked: The image content triggered the content moderation system.
For a complete list of error codes and troubleshooting suggestions, see Error Codes.
Limits
Call mode: Synchronous.
Input image: Width and height ≤ 4,000 pixels; file size ≤ 10 MB; formats: PNG, JPEG, JPG, BMP, or WebP. The image URL must be publicly accessible.
The source language and target language cannot be the same.
Translation quality may be reduced for curved text.
Billing: ¥0.015 per image. For details, see Billing.
The Standard Edition does not support automatic source language identification (you must explicitly pass the
SourceLanguageparameter). If you need automatic identification, use the Pro Edition.