Files
SnapOtter/apps/docs/zh-CN/tools/image/split.md
T
SnapOtterandGitHub f858c4cea0 feat: clearer, disambiguated tool names across all surfaces (#520)
Renames 18 ambiguous or hard-to-search tool names so image tools self-qualify like the other modalities ("Compress" becomes "Compress Image"), and cleans up a few awkward names. Propagated across search (constants.ts), display (en.ts + 20 locales), the OpenAPI base spec + 20 locale specs, and the docs tool-page headings in 21 languages. Removes the duplicate "Normalize Audio" summary shared by the video and audio endpoints. Tool ids and routes are unchanged, so no API paths or bookmarks break.
2026-07-15 21:55:51 +08:00

2.3 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
按行列数或像素尺寸将一张图像分割为网格图块,以 ZIP 压缩包形式返回。 838f5fa791b0 human 49ea1a52dd18

分割图片

按列/行数或指定的像素尺寸将单张图像分割为网格图块。返回包含所有图块的 ZIP 压缩包。

API 端点

POST /api/v1/tools/image/split

参数

参数 类型 必填 默认值 说明
columns integer 3 分割的列数(1 到 100
rows integer 3 分割的行数(1 到 100
tileWidth integer - 图块宽度(像素,最小 10)。当同时设置 tileWidthtileHeight 时,覆盖 columns
tileHeight integer - 图块高度(像素,最小 10)。当同时设置 tileWidthtileHeight 时,覆盖 rows
outputFormat string "original" 图块的输出格式:originalpngjpgwebpavifjxl
quality number 90 有损格式的输出质量(1 到 100

示例请求

curl -X POST http://localhost:1349/api/v1/tools/image/split \
  -F "file=@large-image.png" \
  -F 'settings={"columns":3,"rows":3,"outputFormat":"png"}' \
  --output split-tiles.zip

示例响应

响应以 ZIP 文件形式直接流式返回,附带 Content-Type: application/zip。文件名遵循 split-<jobId>.zip 的模式。

ZIP 内的每个图块命名为 <originalBaseName>_r<row>_c<col>.<ext>(例如 photo_r1_c1.pngphoto_r2_c3.webp)。

说明

  • 接受单个图像文件。
  • 支持 HEIC、RAW、PSD 和 SVG 输入格式(自动解码)。
  • 当同时提供 tileWidthtileHeight 时,它们优先于 columns/rows。网格尺寸按 ceil(imageWidth / tileWidth)ceil(imageHeight / tileHeight) 计算。
  • 如果图像尺寸无法被整除,边缘图块(最右列、最底行)可能小于指定的图块尺寸。
  • 网格尺寸最大限制为 100x100(10,000 个图块)。
  • 响应直接流式返回 ZIP,因此没有 JSON 响应体。搭配 curl 使用 --output 来保存文件。