Skip to content

图像处理与增强

图像能力分为同步处理和异步增强。

同步图像处理

image.process 同时执行页面处理、色彩模式和格式输出:

json
{
  "request_id": "req-image-001",
  "method": "image.process",
  "params": {
    "input_upload_id": "img-...",
    "page_processing": "single_page",
    "color_mode": "auto_optimize",
    "output_format": "jpg",
    "single_page": {
      "auto_rotate": true,
      "smart_black_edge_optimize": true
    }
  }
}

image.process_page 只做页面处理,并保持输入图片格式;image.apply_color_mode 只做色彩模式,也保持输入图片格式。

异步图像增强

先查询能力:

json
{
  "request_id": "req-enhance-cap-001",
  "method": "image.enhance_capabilities",
  "params": {}
}

响应中的 data.providers[].capabilities[] 描述可用增强能力;组装 pipeline 时,通常从能力项中读取 typedefaultsschema 和本地化文案。完整返回结构见 图像接口 - Enhance capabilities 响应结构

提交 pipeline:

json
{
  "request_id": "req-enhance-001",
  "method": "image.enhance",
  "params": {
    "source": {
      "input_upload_ids": ["img-..."]
    },
    "pipeline": {
      "version": "image.enhance.pipeline.v1",
      "steps": [
        {
          "id": "blank",
          "type": "blank_page_detect",
          "enabled": true,
          "params": { "action": "drop" }
        },
        {
          "id": "normalize",
          "type": "normalize",
          "enabled": true,
          "params": { "target": "a4" }
        }
      ],
      "target": {
        "type": "pdf",
        "format": "pdf",
        "export_type": "multi-page"
      }
    }
  }
}

image.enhance_get 查询任务,用 image.enhance_cancel 取消任务。

Workflow

image.enhance_workflow_save 可保存常用 pipeline,后续在拍摄采集或 SANE 扫描中复用:

json
{
  "method": "image.enhance_workflow_save",
  "params": {
    "name": "A4 clean PDF",
    "description": "drop blank pages and export PDF",
    "pipeline": {
      "version": "image.enhance.pipeline.v1",
      "steps": [],
      "target": { "type": "pdf", "format": "pdf", "export_type": "multi-page" }
    }
  }
}

CZUR Open Platform Documentation