Image Translation Pro Version Layer Image Composition API Reference

GET/POST/ai/image/translation/copmosite

Description

After obtaining parameters such as the position, color, and size of the translated text through Image Translation Pro Version API Synchronous Interface and making the necessary content modifications, you can call the Image Translation Pro Version Image Composition API interface to merge the layers and generate the final image.

Parameter Request

Parameter
Parameter
Type
Required
Description

paramJson

Object

true

srcImage

String

true

The field src_image in the response of the Image Translation Pro Editor or Image Translation Pro Synchronous API.

editInfo

String

ture

The field edit_info (in JSON string format) in the response of the Image Translation Pro Editor or Image Translation Pro Synchronous API. Note: If modification of the text after image composition is required, please manually parse the edit_info field and edit the value at edit_info.textAreas.texts.value level.

Sample Request

/*The domain url of the API. *for api purchased on global site. set api_domain to "https://api.aidc-ai.com" For APIs purchased from the Chinese site, please use"https://cn-api.aidc-ai.com"domain (for api purchased on chinese site) set api_domain to "https://cn-api.aidc-ai.com"/ IopClient client = new IopClientImpl("domain url", "your key", "your secret"); IopRequest request = new IopRequest(); request.setApiName("/ai/image/translation/composite"); // If you have not purchased a formal quota, please add a trial flag; otherwise, you will receive a NoResource error code. // request.addHeaderParameter("x-iop-trial","true"); JSONObject jsonObject = new JSONObject(); jsonObject.put("editInfo", "{"goodsRects":{"top":238,"left":0,"width":631,"height":459},"languages":["ja"],"resultImageIds":["58538d2a-5258-11f0-b542-00163e0eb98a"],"textAreas":[{"horizontalLayout":"left","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"left","verticalLayout":"center","color":"#525252","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":78,"left":39,"width":429,"degree":0,"height":65},"fontsize":40,"language":"ja","value":"かわいいデザイン・クリアなベル音","textRect":{"top":91,"left":48,"width":700,"degree":0,"height":40},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":40,"content":"萌趣造型·清脆响铃","lineCount":1},{"horizontalLayout":"left","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"left","verticalLayout":"center","color":"#a2a2a2","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":146,"left":39,"width":460,"degree":0,"height":76},"fontsize":27,"language":"ja","value":"揺れるとクリアなベル音が鳴り、子供の目を引きます","textRect":{"top":154,"left":45,"width":700,"degree":0,"height":60},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":23,"content":"在摇晃的时候,会发出清脆的铃铃声 吸引孩子目光","lineCount":2},{"horizontalLayout":"right","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"right","verticalLayout":"center","color":"#098b98","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":224,"left":616,"width":160,"degree":0,"height":94},"fontsize":22,"language":"ja","value":"ベルベルベル","textRect":{"top":251,"left":629,"width":134,"degree":15.036200506607228,"height":40},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":41,"content":"铃铃铃","lineCount":1}],"repairedUrl":"https://aib-image.oss-ap-southeast-1.aliyuncs.com/tufan%2F574da64a-5258-11f0-a074-00163e0eb98a.png?OSSAccessKeyId=LTAI5tSEGjGp5wixZgHLc3bV&Expires=4967591982&Signature=Dm2Ck8zobVXmVluvfsRdjtbneo4%3D","font":["AlibabaSansJP-Bold"]}"); jsonObject.put("srcImage", "https://img.alicdn.com/imgextra/i3/O1CN01HTDhDi28Fd85ZYs7H_!!6000000007903-0-tps-800-800.jpg"); request.addApiParameter("paramJson", jsonObject.toString()); IopResponse response = client.execute(request); System.out.println(response.getBody()); Thread.sleep(10);

// Sample request parameters { "editInfo":"{"goodsRects":{"top":238,"left":0,"width":631,"height":459},"languages":["ja"],"resultImageIds":["58538d2a-5258-11f0-b542-00163e0eb98a"],"textAreas":[{"horizontalLayout":"left","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"left","verticalLayout":"center","color":"#525252","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":78,"left":39,"width":429,"degree":0,"height":65},"fontsize":40,"language":"ja","value":"かわいいデザイン・クリアなベル音","textRect":{"top":91,"left":48,"width":700,"degree":0,"height":40},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":40,"content":"萌趣造型·清脆响铃","lineCount":1},{"horizontalLayout":"left","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"left","verticalLayout":"center","color":"#a2a2a2","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":146,"left":39,"width":460,"degree":0,"height":76},"fontsize":27,"language":"ja","value":"揺れるとクリアなベル音が鳴り、子供の目を引きます","textRect":{"top":154,"left":45,"width":700,"degree":0,"height":60},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":23,"content":"在摇晃的时候,会发出清脆的铃铃声 吸引孩子目光","lineCount":2},{"horizontalLayout":"right","verticalLayout":"center","color":"#000000","texts":[{"valid":true,"horizontalLayout":"right","verticalLayout":"center","color":"#098b98","ovis_err_msg":"| ovis time: 1.655","imageRect":{"top":224,"left":616,"width":160,"degree":0,"height":94},"fontsize":22,"language":"ja","value":"ベルベルベル","textRect":{"top":251,"left":629,"width":134,"degree":15.036200506607228,"height":40},"trans_model_name":"MarcoVL2-8B-PicTrans","lineCount":1}],"fontsize":41,"content":"铃铃铃","lineCount":1}],"repairedUrl":"https://aib-image.oss-ap-southeast-1.aliyuncs.com/tufan%2F574da64a-5258-11f0-a074-00163e0eb98a.png?OSSAccessKeyId=LTAI5tSEGjGp5wixZgHLc3bV&Expires=4967591982&Signature=Dm2Ck8zobVXmVluvfsRdjtbneo4%3D","font":["AlibabaSansJP-Bold"]}", "srcImage":"https://img.alicdn.com/imgextra/i3/O1CN01HTDhDi28Fd85ZYs7H_!!6000000007903-0-tps-800-800.jpg" }

Parameters Response

Parameter
Parameter
Parameter
Type
Description

imageResult

Object

response result

code

number

response code

data

Object

imageUrl

String

layer merging result

usage

number

usage

requestId

request ID

success

boolean

message

String

resCode

Number

response code 200

resMessage

String

response message

request_id

String

request ID

_trace_id

String

Trace

Sample Response

{ "resCode": 200, "resMessage": "success", "imageResult": { "code": 200, "data": { "imageUrl": "https://piccopilot.oss-accelerate.aliyuncs.com/compose/7c89c391-acb0-4ff4-8804-564c7f953cee.png?OSSAccessKeyId=LTAI5tR9CxJh5q35LYbhGAeT&Expires=4967593669&Signature=Hxrc5T%2BKn6Z8tR1qJRniZOQJnWg%3D", "usage": 0, "class": "com.aidc.service.api.client.image.dto.ImageGenResponse" }, "requestId": "0bb7408b17509216673995113e0e95", "success": true, "message": "success", "class": "com.aidc.service.api.client.common.Result" }, "code": "0", "request_id": "2151fa1917509216676262651", "trace_id": "0bb7408b17509216673995113e0e95" }

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 ([email protected]) 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.

801

model failed

Internal call exception,please contact us via Discord or email us ([email protected]) for troubleshooting.

900

tpp url error

Internal call exception,please contact us via Discord or email us ([email protected]) 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.

1002

content risk filter failed, please contact us

Content risk filter failed. Please contact us via Discord or email us ([email protected]).

Last updated

Was this helpful?