Crop Image Skill
Service Endpoints
- - API Base URL: INLINECODE0
- Health: INLINECODE1
- Crop by URL: INLINECODE2
- Crop by Upload: INLINECODE3
- Docs: INLINECODE4
Execute Crop by URL
- 1. Validate input fields:
- -
url must be a reachable image URL. - INLINECODE6 and
height must be integers in [1, 4096].
- 2. Call endpoint:
CODEBLOCK0
- 3. Return response fields:
- - INLINECODE9
- INLINECODE10
- INLINECODE11
Execute Crop by Upload
- 1. Prefer upload mode for user-provided local files.
- 2. Call endpoint:
CODEBLOCK1
- 3. Return response fields:
- - INLINECODE12
- INLINECODE13
- INLINECODE14
Error Handling
- - HTTP
400: invalid image source or decode failure - HTTP
422: validation failure (invalid URL, invalid width/height) - HTTP
500: service or configuration failure
When failure occurs:
- 1. Return the original status code and
detail. - Ask caller to change input for
400/422. - Retry only for transient
500 or network timeout.
Success Example
CODEBLOCK2
Failure Example
CODEBLOCK3
裁剪图片技能
服务端点
- - API 基础地址:https://api.imageclaw.net
- 健康检查:https://api.imageclaw.net/health
- 通过URL裁剪:https://api.imageclaw.net/crop
- 通过上传裁剪:https://api.imageclaw.net/crop/upload
- 文档:https://api.imageclaw.net/docs
通过URL执行裁剪
- 1. 验证输入字段:
- - url 必须是可访问的图片URL。
- width 和 height 必须是 [1, 4096] 范围内的整数。
- 2. 调用端点:
bash
curl -sS -X POST https://api.imageclaw.net/crop \
-H content-type: application/json \
-d {
url: https://picsum.photos/800/600,
width: 256,
height: 256
}
- 3. 返回响应字段:
- - croppedurl
- originalsize
- face_detected
通过上传执行裁剪
- 1. 对于用户提供的本地文件,优先使用上传模式。
- 2. 调用端点:
bash
curl -sS -X POST https://api.imageclaw.net/crop/upload \
-F file=@/absolute/path/to/photo.jpg \
-F width=256 \
-F height=256
- 3. 返回响应字段:
- - croppedurl
- originalsize
- face_detected
错误处理
- - HTTP 400:无效的图片源或解码失败
- HTTP 422:验证失败(无效的URL、无效的宽度/高度)
- HTTP 500:服务或配置故障
发生故障时:
- 1. 返回原始状态码和 detail。
- 对于 400/422 错误,要求调用方更改输入。
- 仅对临时性的 500 错误或网络超时进行重试。
成功示例
json
{
croppedurl: https://crop.imagebee.net/crops/1772761350b8050bd6ec26.jpg,
original_size: [800, 600],
face_detected: false
}
失败示例
json
{
detail: 不是图片:内容类型为 application/json
}