此接口用于组合使用对象存储的图片处理功能和豆包的图生图模型,并将处理后的图片存储到指定存储桶。
GET /?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": "千军万马", "ImageUri": "https://xxx" }, "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" } } }
该请求使用的公共请求消息头,请参见公共参数。
名称 | 位置 | 参数类型 | 是否必选 | 示例值 | 说明 |
---|---|---|---|---|---|
x-tos-process | Query | String | 是 | - | 代表 ImageToImage 接口请求的特殊标识,取值 |
名称 | 参数类型 | 是否必填 | 示例值 | 说明 |
---|---|---|---|---|
TaskType | String | 是 | image_to_image | 任务类型,该场景下,取值 |
InputDataSource | Array of String | 是 | - | 待处理的原图。 |
ImageUri | String | 是 | 1171.jpeg | 待处理的原图名称。 说明 使用图片处理功能和图生图模型对原图进行处理时,会从请求访问的存储桶中读取图片,所以您只需要填写原图在存储桶中的名称,即可指定原图。 |
Prompt | String | 是 | 千军万马 | 生成图像的提示词。 |
InputProcessing | Array of String | 否 | - | 在使用图生图模型前,根据需要使用对象存储的图片处理功能对图片进行预处理。 |
ProcessStyle | String | 否 | style01 | 图片预处理时,通过图片样式指定对象存储的图片处理方式。关于图片样式的详细介绍,请参见创建图片样式。 |
ProcessActions | String | 否 | image/resize,w_100 | 图片预处理时,通过图片处理参数指定对象存储的图片处理方式。关于图片处理参数的详细介绍,请参见图片处理概述。 说明 仅支持配置 |
OutputProcessing | Array of String | 是 | - | 在使用图生图模型生成图片后,根据需要使用对象存储的图片处理功能对图片进行后处理。 |
Bucket | String | 是 | tostest | 存储处理后图片的存储桶。 |
Object | String | 是 | save_img | 处理后图片的名称。 |
ForbiddenOverwrite | String | 否 | false | 将处理后的图片存储到存储桶时,如果存储桶中有同名文件,是否覆盖该文件,说明如下:
父节点:OutputProcessing |
ProcessStyle | String | 否 | style01 | 图片后处理时,通过图片样式指定对象存储的图片处理方式。关于图片样式的详细介绍,请参见创建图片样式。 |
ProcessActions | String | 否 | image/resize,w_100 | 图片后处理时,通过图片处理参数指定对象存储的图片处理方式。关于图片处理参数的详细介绍,请参见图片处理概述。 说明 仅支持配置 |
ModelConfig | String | 是 | - | 配置豆包图生图模型。 |
ModelAction | String | 否 | CVProcess | 豆包图生图模型接口名称。 父节点:ModelConfig |
ModelVersion | String | 否 | 2022-08-31 | 豆包图生图模型接口版本号。 |
ReqJson | String | 否 | "req_key": "high_aes" | 豆包图生图模型接口的请求 body 参数,即您需要在 父节点:ModelConfig 说明 如果同时配置了 |
该请求返回公共响应消息头。更多信息,请参见公共参数。
该请求响应会返回调用的豆包图生图模型接口的响应元素,详细参数介绍,请参见图生图模型接口文档。
GET /?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": "千军万马", "ImageUri": "1171.jpeg" }, "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" } } }
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" } }