GetImageTranslate - 商品图片智能翻译

更新时间:
复制 MD 格式

包含文字识别、文本翻译、文字回填等能力。

接口说明

重要 该接口已计划下线,不建议继续调用。
说明 替代接口为图片翻译。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

alimt:GetImageTranslate

get

*全部资源

*

无 无

请求参数

名称

类型

必填

描述

示例值

Url

string

是

需要翻译的图片链接

http://xxxxxxx.oss-cn-shenzhen.aliyuncs.com/xxxxxx.jpg

SourceLanguage

string

是

图片中的文字语种, 语向支持以及语言代码

zh

TargetLanguage

string

是

图片中文字翻译后的语种, 语向支持以及语言代码

en

Extra

string

否

  • 以下 JSON 内容格式,不关注的都可以不用传递,都是可选参数

  • JSON 格式内容:

{
  "have_ocr": "false",
  "without_text":"true",
  "have_psd": "false",
  "ignore_entity": "false"
}
  • have_ocr 通过 true/false 控制是否返回 ocr 结果,true:需要,false:不需要

  • without_text 控制是否需要擦除图片中的文字,true:需要,false:不需要

  • have_psd 用于图片编辑器,psd 数据渲染编辑器

  • ignore_entity 是否忽略实体识别,true:忽略实体识别,false:不忽略

{"have_ocr": "false", "without_text":"true", "have_psd": "false", "ignore_entity": "false"}

返回参数

名称

类型

描述

示例值

object

Code

integer

状态码,200 表示正常

200

Message

string

错误的时候,返回的错误信息

ok

RequestId

string

请求的唯一串

A41F6E25-8520-4AF0-90EF-AF7E32840108

Data

object

返回的数据内容

Url

string

翻译后的图片链接

https://ae01.alicdn.com/kf/xxxxx.jpeg

Orc

string

orc 识别后的内容

{"text":"P翼-至草款","width":750,"wordNum":10}

PictureEditor

string

用于图片编辑器渲染的 psd 数据

{"text":"P翼-至草款","width":750,"wordNum":10}

示例

正常返回示例

JSON格式

{
  "Code": 200,
  "Message": "ok",
  "RequestId": "A41F6E25-8520-4AF0-90EF-AF7E32840108",
  "Data": {
    "Url": "https://ae01.alicdn.com/kf/xxxxx.jpeg",
    "Orc": "{\"text\":\"P翼-至草款\",\"width\":750,\"wordNum\":10}",
    "PictureEditor": "{\"text\":\"P翼-至草款\",\"width\":750,\"wordNum\":10}"
  }
}

错误码

HTTP status code

错误码

错误信息

描述

110 System.AccountNotActivated The account has not activated the service.
111 System.SubServiceFailed Sub-account service failed.
199 System.unknownError An unknown error occurred.
101 System.RequestTimeOut The request has timed out.
112 System.TranslateServiceCallFailed Failed to call the translation service.
102 System.Error A system error occurred.
113 System.AccountNotActivatedOrInArrears The service is not activated or the account has an outstanding balance.
103 System.UrlDecodingError An error occurred while decoding the URL. Verify that the specified URL is encoded.
104 System.ParameterError Some required parameters are missing.
105 System.LanguageNotSupported The specified language pair is not supported.
106 System.LanguageDetectError An error occurred while detecting the language.
107 System.TranslateError An error occurred while translating.
108 System.StringTooLong The maximum length of the specified string is exceeded.
109 System.subNotPermission The sub-account is not authorized to perform the operation.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。