Domain name for API request: tmt.intl.tencentcloudapi.com.
This API is used to provide translation service for images in 18 languages. It can automatically recognize text content in images and translate it into the target language. The recognized text is translated line by line, and a version that supports paragraph translation will be offered subsequently.
-Input image format: png, jpg, jpeg and other common image formats. gif animation is not supported.
-Output image format: jpg.
Notification: For general developers, we recommend prioritizing SDK integration to simplify development. For SDK usage introduction, directly view the 5. Developer Resources part.
A maximum of 1 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: ImageTranslateLLM. |
| Version | Yes | String | Common Params. The value used for this API: 2018-03-21. |
| Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
| Data | Yes | String | Base64 string of the image data, no more than 9M after Base64 encoding. A resolution of 600*800 or higher is recommended. PNG, JPG, and JPEG formats are supported. |
| Target | Yes | String | Target language, supported languages:
|
| Url | No | String | Enter image Url. When using a Url, the Data parameter requires the input of "". Image restrictions: less than 10MB, resolution recommendation 600*800 or higher, format support jpg, jpeg, png. |
| Mode | No | Integer | Invocation method. Enumeration value:
Default value: 0 |
| Parameter Name | Type | Description |
|---|---|---|
| Data | String | Base64 string of the image data. The output format is JPG. |
| Source | String | Primary source language. |
| Target | String | Target translation language. |
| SourceText | String | All original text in the image. |
| TargetText | String | All translations in the image. |
| Angle | Float | Image angle counterclockwise, value range 0-359 |
| TransDetails | Array of TransDetail | Translation detailed information |
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
POST / HTTP/1.1
Host: tmt.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImageTranslateLLM
<Common request parameters>
{
"Data": "/9j/4AAQSkZJRg...rF530LvvALAD5Mkgv0ULqKbuJJbW5en/9k=",
"Target": "en",
"Url": null
}
{
"Response": {
"Angle": 270,
"Data": "/9j/4AAQSkZJRg...rF530LvvALAD5Mkgv0ULqKbuJJbW5en/9k=",
"RequestId": "defb956d-xxxx-xxxx-xxxx-2595b7bc2c28",
"Source": "en",
"SourceText": "hello.",
"Target": "zh",
Hello.
"TransDetails": [
{
"BoundingBox": {
"Height": 90,
"Width": 518,
"X": 348,
"Y": 147
},
"LineHeight": 0,
"LinesCount": 0,
"RotateParagraphRect": {
"Coord": [
{
"X": 348,
"Y": 147
},
{
"X": 866,
"Y": 147
},
{
"X": 866,
"Y": 238
},
{
"X": 348,
"Y": 238
}
],
"TiltAngle": 0,
"Valid": false
},
"SourceLineText": "hello.",
"SpamCode": 0,
Hello.
}
]
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation.DecodeErr | Image decoding failed |
| FailedOperation.DownloadErr | Image download error |
| FailedOperation.ErrorUserArea | User region differs from requested service area. |
| FailedOperation.NoFreeAmount | The free quota for this month is used up. To continue to use the service, you need to upgrade to a paid account in the TMT console. |
| FailedOperation.ServiceIsolate | The service is suspended due to overdue payments. Top up your account first. |
| FailedOperation.StopUsing | Services for the account has been stopped. |
| FailedOperation.UserNotRegistered | The service is not activated. Activate it in the TMT console first. |
| InternalError | Internal error. |
| InternalError.BackendTimeout | Backend service timeout. Please try again later. |
| InternalError.ErrorUnknown | Unknown error. |
| InternalError.RequestFailed | Request failed. |
| InvalidParameter | Invalid parameter. |
| InvalidParameter.MissingParameter | Invalid parameter. |
| LimitExceeded | The quota limit is reached. |
| MissingParameter | Missing parameter. |
| UnauthorizedOperation.ActionNotFound | Incorrect name entered in the Action field. |
| UnsupportedOperation | Unsupported operation. |
| UnsupportedOperation.UnSupportedTargetLanguage | Unsupported target language. Please refer to the supported language list. |
| UnsupportedOperation.UnsupportedLanguage | Unsupported language. Please refer to the supported language list. |
| UnsupportedOperation.UnsupportedSourceLanguage | Unsupported source language. Please refer to the supported language list. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan