调用GetImageCroppingSuggestions接口获取图片裁剪建议。
接口说明
该功能不依赖媒体集。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | GetImageCroppingSuggestions |
操作接口名称,固定取值为GetImageCroppingSuggestions。 |
AspectRatios | String | 是 | ["1:1","2:3"] |
裁剪比例列表,仅支持整数比例。 |
ImageUri | String | 是 | oss://imm-test/testcases/imagecroppingtest.jpg |
图片的OSS URI。 OSS地址规则为 |
Project | String | 是 | immimagetest |
项目名称。 |
RegionId | String | 否 | cn-hangzhou |
项目所在地域的ID。 地域Endpoint格式为 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
CroppingSuggestions | Array of CroppingSuggestions |
图片的裁剪建议。 |
|
AspectRatio | String | 1:1 |
图片裁剪比例。 |
CroppingBoundary | Struct |
裁剪框信息。 |
|
Height | Integer | 500 |
裁剪框高度。单位为px。 |
Left | Integer | 0 |
顶点X坐标,距离左端距离。单位为px。 |
Top | Integer | 77 |
顶点Y坐标,距离顶端距离。单位为px。 |
Width | Integer | 500 |
裁剪框宽度。单位为px。 |
Score | Float | 0.6979608535766602 |
该裁剪方案的美学分数,分数越高表示该方案效果越好,取值范围为0~1。 |
ImageUri | String | oss://imm-test/testcases/imagecroppingtest.jpg |
图片的OSS URI。 |
RequestId | String | EA153782-13A5-44EE-835A-90A14FC51352 |
当次请求的Request ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=GetImageCroppingSuggestions
&AspectRatios=["1:1","2:3"]
&ImageUri=oss://imm-test/testcases/imagecroppingtest.jpg
&Project=immimagetest
&<公共请求参数>
正常返回示例
XML
格式
<RequestId>EA153782-13A5-44EE-835A-90A14FC51352</RequestId>
<ImageUri>oss://imm-test/testcases/imagecroppingtest.jpg</ImageUri>
<CroppingSuggestions>
<AspectRatio>1:1</AspectRatio>
<Score>0.6979608535766602</Score>
<CroppingBoundary>
<Left>0</Left>
<Top>77</Top>
<Height>500</Height>
<Width>500</Width>
</CroppingBoundary>
</CroppingSuggestions>
<CroppingSuggestions>
<AspectRatio>2:3</AspectRatio>
<Score>0.781792938709259</Score>
<CroppingBoundary>
<Left>0</Left>
<Top>77</Top>
<Height>750</Height>
<Width>500</Width>
</CroppingBoundary>
</CroppingSuggestions>
JSON
格式
{
"RequestId": "EA153782-13A5-44EE-835A-90A14FC51352",
"ImageUri": "oss://imm-test/testcases/imagecroppingtest.jpg",
"CroppingSuggestions": [
{
"AspectRatio": "1:1",
"Score": "0.6979608535766602",
"CroppingBoundary": {
"Left": 0,
"Top": 77,
"Height": 500,
"Width": 500
}
},
{
"AspectRatio": "2:3",
"Score": "0.781792938709259",
"CroppingBoundary": {
"Left": 0,
"Top": 77,
"Height": 750,
"Width": 500
}
}
]
}
在文档使用中是否遇到以下问题
更多建议
匿名提交