图片宫格切图API接口
接口描述
图片宫格切图接口,可以将图片分割成多张小图,用来组合成微博或朋友圈宫格、四宫格、六宫格、九宫格、十二宫格或更多宫格排列的图像。
GET https://www.idcd.com/api/image-grid-crop
输入参数
以下请求参数列表仅列出了接口请求参数,不包含公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 类型 | 必选 | 描述 |
---|---|---|---|
image_url | String | 否 | 图片网络地址,image_url 和 image_base64 二者选一 |
image_base64 | String | 否 | 图片base64编码, image_base64 和 image_url 二者选一 |
rows | Int | 否 | 宫格行数 默认:3 |
cols | Int | 否 | 宫格列数 默认:3 |
输出参数
参数名称 | 类型 | 必选 | 描述 |
---|---|---|---|
url | String | 是 | 图片地址 |
name | String | 是 | 图片名称 |
path | String | 是 | 图片路径 |
size | Int | 是 | 图片大小 |
uuid | String | 是 | UUID |
hash | String | 是 | Hash |
extension | String | 是 | 后缀 |
mime | String | 是 | 图片类型 |
示例
- 输入示例
curl --location --request POST 'https://www.idcd.com/api/image-grid-crop' \
--header 'ClientID: df77f2de-2924-4499-adda-1c4cc243625a' \
--header 'Nonce: v0j38hHHUEqFwoh0Gc8Rbfi737xtIpLL' \
--header 'Timestamp: 1716085926' \
--header 'Signature: 5b1230f42bad2ffd5ad09890a8ebb47c02d74668be0cf7bb54a0f6a14996117b' \
--header 'SignatureMethod: HmacSHA256' \
--header 'Content-Type: application/json' \
--data-raw '{
"image_url": "https://www.idcd.com/storage/uploads/images/grid/01J0JES4GBK3DBXYS3TARAV9H7.png",
"rows": 2,
"cols": 2
}'
- 输出示例
{
"status": true,
"code": 200,
"message": "Success",
"request_id": "5346db06-cc1c-4eef-9fa1-4f7cbe002f86",
"data": [
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_1.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_1.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_1.png",
"size": 430,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_1",
"hash": "e9b8042fa5ae5aee6e59dc696c53ab9f",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_2.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_2.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_2.png",
"size": 413,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_2",
"hash": "919297cc70a4a46390c2b9daee7119ad",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_3.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_3.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_3.png",
"size": 150,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_3",
"hash": "1742176c38436850ec0676ca7c6173ae",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_4.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_4.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_4.png",
"size": 440,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_4",
"hash": "ff44fbc57db2f8aaab4f27a12f9f505d",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_5.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_5.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_5.png",
"size": 1454,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_5",
"hash": "b2ac0dd4b4293fedd02121a0a7a0cae5",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_6.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_6.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_6.png",
"size": 426,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_6",
"hash": "8de2c1fac7092d827c6ae52d0ff7e079",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_7.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_7.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_7.png",
"size": 150,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_7",
"hash": "1742176c38436850ec0676ca7c6173ae",
"extension": "png",
"mime": "image/png"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_8.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_8.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_8.png",
"size": 435,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_8",
"hash": "fe1fdfadb553926aaf6712f15844258b"
},
{
"url": "https://www.idcd.com/storage/grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_9.png",
"name": "grid_01J0JKMJP1NGV0PNJBJNMBSZTT_9.png",
"path": "grid/grid_01J0JKMJP1NGV0PNJBJNMBSZTT_9.png",
"size": 460,
"uuid": "01J0JKMJP1NGV0PNJBJNMBSZTT_9",
"hash": "75ff8d32cd5c5845b398d57a569b3928",
"extension": "png",
"mime": "image/png"
}
]
}