You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
AIGC
ImageToImage
Copy page
Download PDF
ImageToImage
Feature description​
This API combines object storage image processing functions with the Doubao ImageToImage model and stores the processed images in the specified bucket.​
tip​
HNS buckets do not support the ImageToImage API.​
Request syntax​
​
POST /?x-tos-process=aigc/image_to_image HTTP/1.1​
Host: bucketname.tos-cn-beijing.volces.com​
Date: Mon, 31 Oct 2016 12:00:00 GMT​
Authorization: authorization string​
Content-Length: length​
{​
"TaskType": "image_to_image",​
"InputDataSource": {​
"Prompt": "Thousands of troops",​
"ImageUri": "abc.jpg"​
},​
"InputProcessing": {​
"ProcessStyle": "",​
"ProcessActions": "image/resize,w_100"​
},​
"OutputProcessing": {​
"Bucket": "tostest",​
"Object": "newgen.jpg",​
"ForbiddenOverwrite": false,​
"ProcessStyle": "",​
"ProcessActions": "image/rotate,90"​
},​
"ModelConfig": {​
"ModelAction": "CVProcess",​
"ModelVersion": "2022-08-31",​
"ReqJson": {​
"req_key": "i2i_xl_sft"​
}​
}​
}​
​
Request parameters and headers​
This request uses common request headers, see Common Parameters.​
​
Name​
Location​
Type​
Required​
Sample value​
Note​
x-tos-process​
Query​
String​
Yes​
-​
Special identifier representing the ImageToImage interface request, with the value aigc/image_to_image.​
​
Request body elements​
​
Name​
Type​
Required​
Sample value​
Note​
TaskType​
String​
Yes​
image_to_image​
Task type. In this scenario, the value is image_to_image, indicating the combined use of image processing and image-to-image models.​
InputDataSource​
Array of String​
Yes​
-​
Original image to be processed.​
ImageUri​
String​
Yes​
abc.jpg​
Name of the original image to be processed.​
Parent node: InputDataSource​
tip​
When using image processing and image-to-image models to process the original image, the image will be read from the requested storage bucket. You only need to enter the original image's name in the bucket to specify it.​
Prompt​
String​
Yes​
Thousands of troops​
Prompt for generating images.​
Parent node: InputDataSource​
InputProcessing​
Array of String​
No​
-​
Before using the image-to-image model, preprocess the image as needed using the object storage's image processing features.​
ProcessStyle​
String​
No​
style01​
When preprocessing images, specify the image processing method for object storage through image styles. For detailed information about image styles, see Create Image Styles.​
Parent node: InputProcessing​
ProcessActions​
String​
No​
image/resize,w_100​
When preprocessing images, specify the object storage image processing method through image processing parameters. For detailed information about image processing parameters, refer to Image Processing Overview.​
Parent node: InputProcessing​
tip​
Only one of the parameters ProcessStyle and ProcessActions can be configured; configuring both simultaneously is not supported.​
OutputProcessing​
Array of String​
Yes​
-​
After using the image-to-image model to generate pictures, use the object storage image processing feature for post-processing as needed.​
Bucket​
String​
Yes​
tostest​
Storage bucket for processed images.​
Parent node: OutputProcessing​
Object​
String​
Yes​
save_img​
Name of the processed image.​
Parent node: OutputProcessing​
ForbiddenOverwrite​
String​
No​
false​
When saving the processed image to the storage bucket, if a file with the same name exists, specify whether to overwrite it. Explanation:​
  • true: do not overwrite the file with the same name; report an error directly and prohibit writing to the storage bucket.​
  • false: overwrite files with the same name.​
Parent node: OutputProcessing​
ProcessStyle​
String​
No​
style01​
During image post-processing, the image style specifies the method for processing images stored in object storage. For detailed information on image styles, see Create image style.​
Parent node: OutputProcessing​
ProcessActions​
String​
No​
image/resize,w_100​
During image post-processing, specify the image processing method for object storage through the image processing parameters. For detailed information on image processing parameters, refer to Image Processing Overview.​
Parent node: OutputProcessing​
tip​
Only one of the parameters ProcessStyle and ProcessActions can be configured; configuring both simultaneously is not supported.​
ModelConfig​
String​
Yes​
-​
Configure the Doubao image generation model.​
ModelAction​
String​
No​
CVProcess​
Name of the Doubao image-to-image model interface.​
Parent node: ModelConfig​
ModelVersion​
String​
No​
2022-08-31​
Doubao image generation model interface version number.​
Parent node: ModelConfig​
ReqJson​
String​
No​
"req_key": "high_aes"​
The request body parameters for the Doubao image generation model interface, which you need to set in ReqJson to configure the image generation model, defining the desired style and content of the generated image. ​
Parent node: ModelConfig​
tip​
If both InputDataSource.Prompt and ReqJson.Prompt are configured, the final result uses the setting from InputDataSource.Prompt.​
​
Response headers​
The response contains only common headers. For more information, please see Public Parameters.​
Response body elements​
The response body elements returned by this request correspond to the invoked Doubao I2I model interface.​
Sample request​
​
POST /?x-tos-process=aigc/text_to_imgage HTTP/1.1​
Host: examplebucket.tos-cn-beijing.volces.com​
Date: Mon, 31 Oct 2016 12:00:00 GMT​
Authorization: authorization string​
Content-Length: length​
{​
"TaskType": "image_to_image",​
"InputDataSource": {​
"Prompt": "Thousands of troops",​
"ImageUri": "abc.jpg"​
},​
"InputProcessing": {​
"ProcessStyle": "",​
"ProcessActions": "image/resize,w_100"​
},​
"OutputProcessing": {​
"Bucket": "tostest",​
"Object": "newgen.jpg",​
"ForbiddenOverwrite": false,​
"ProcessStyle": "",​
"ProcessActions": "image/rotate,90"​
},​
"ModelConfig": {​
"ModelAction": "CVProcess",​
"ModelVersion": "2022-08-31",​
"ReqJson": {​
"req_key": "i2i_xl_sft"​
}​
}​
}​
​
Sample response​
​
HTTP/1.1 200 OK​
x-tos-id-2: f91b0c03a01300c1-a444ed0​
x-tos-request-id: f91b0c03a01300c1-a444ed0​
Date: Fri, 30 Jul 2021 06:45:39 GMT​
server: TosServer​
Content-Length: 340​
{​
"resp_json": {​
"code": 10000,​
"data": {​
"algorithm_base_resp": {​
"status_code": 0,​
"status_message": "Success"​
},​
"binary_data_base64": null,​
"comfyui_cost": 5,​
"controlnet_args.canny.binary_data_index": 0,​
"controlnet_args.canny.strength": 0,​
"controlnet_args.depth.binary_data_index": 0,​
"controlnet_args.depth.strength": 0,​
"controlnet_args.pose.binary_data_index": 0,​
"controlnet_args.pose.strength": 0,​
"etta_args.binary_data_index": 1,​
"image_urls": null,​
"multi_pipeline_select_key": "i2i",​
"request_id": "b98ab7c4d28203683e22b80e3da0b6e9cc58aab1ef0ac5efc28724f261acd5a3",​
"style_reference_args.binary_data_index": 0,​
"style_reference_args.id_weight": 0,​
"style_reference_args.style_weight": 0​
},​
"message": "Success",​
"request_id": "202504231214007C87515990141CB30ED2",​
"status": 10000,​
"time_elapsed": "6.430430379s"​
}​
}​
​
​
Last updated: 2026.06.17 17:18:34