Files
SnapOtter/apps/docs/zh-TW/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 8ac843918d49

分割影像

依欄/列數或指定的像素尺寸將單一影像切割成網格圖塊。回傳包含所有圖塊的 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 儲存檔案。