图片
Compress an image
Upload a JPEG, PNG, or WebP and download a smaller file of the same type.
Compress Image
API 参考
通过 REST 提交
使用您的个人 API 密钥(msk_…),从您自己的工具为此工作负载创建任务。以这种方式启动的任务会在您于您的设备中连接的同一批设备上运行——至少需要有一台在线。
https://cp.meshlabs.cloud/v1/organizations/jobs使用 X-Organization-Api-Key: msk_your_personal_api_key 进行身份验证。该请求头名称与组织密钥相同;个人密钥使用相同的端点。
POST https://cp.meshlabs.cloud/v1/organizations/job-inputs/presign,将文件上传到返回的 upload_url,然后在 job_spec 中传入 download_url(例如作为 input_image_url)。请求体
{
"workload_type": "compress-image",
"job_spec": {
"input_image_url": "https://…/your-input.png",
"quality": 80
}
}job_spec 字段
| 字段 | 必填 | 默认值 | 说明 |
|---|---|---|---|
input_image_url | 是 | — | One JPEG, PNG, or WebP, up to 40 MB. |
quality | 否 | 80 | JPEG and WebP quality. PNG is repacked losslessly. |
cURL
curl -X POST https://cp.meshlabs.cloud/v1/organizations/jobs \
-H "X-Organization-Api-Key: msk_your_personal_api_key" \
-H "Content-Type: application/json" \
-d '{
"workload_type": "compress-image",
"job_spec": {
"input_image_url": "https://…/your-input.png",
"quality": 80
}
}'https://cp.meshlabs.cloud/v1/organizations/jobs/{job_id}使用同一 API 密钥轮询,直到 status 进入终态(COMPLETED、FAILED、CANCELED 或 MODERATION_BLOCKED)。启用内容审核时,任务可能会先处于 MODERATION_PENDING 状态,然后才进入计算队列。已完成的任务会在每个输出上包含预签名的 download_url 值。
创建响应
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"workload_type": "compress-image",
"status": "PENDING",
"job_spec_json": {
"input_image_url": "https://…/your-input.png",
"quality": 80
},
"work_units": [],
"outputs": [],
"created_at": "2026-06-08T12:00:00Z",
"updated_at": "2026-06-08T12:00:00Z"
}完成响应
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"workload_type": "compress-image",
"status": "COMPLETED",
"job_spec_json": {
"input_image_url": "https://…/your-input.png",
"quality": 80
},
"work_units": [
{
"id": "…",
"index": 0,
"status": "COMPLETED"
}
],
"outputs": [
{
"id": "…",
"output_type": "<output type>",
"filename": "<output filename>",
"size_bytes": 524288,
"download_url": "<presigned output download URL>"
}
],
"created_at": "2026-06-08T12:00:00Z",
"updated_at": "<completion timestamp>"
}Upload a JPEG, PNG, or WebP and download a smaller file of the same type. Compress image keeps the format you started with: JPEG and WebP take a quality from 40 to 95, default 80, and PNG is repacked without dropping pixels. One image per job, up to 40 MB and 50 million pixels, on a device you connect.