mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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.
2.3 KiB
2.3 KiB
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)。當同時設定 tileWidth 與 tileHeight 時,會覆寫 columns。 |
| tileHeight | integer | 否 | - | 圖塊高度(像素)(最小 10)。當同時設定 tileWidth 與 tileHeight 時,會覆寫 rows。 |
| outputFormat | string | 否 | "original" |
圖塊的輸出格式:original、png、jpg、webp、avif、jxl |
| 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.png、photo_r2_c3.webp)。
注意事項
- 接受單一影像檔案。
- 支援 HEIC、RAW、PSD 與 SVG 輸入格式(自動解碼)。
- 當同時提供
tileWidth與tileHeight時,它們的優先順序高於columns/rows。網格尺寸計算方式為ceil(imageWidth / tileWidth)與ceil(imageHeight / tileHeight)。 - 若影像尺寸無法整除,邊緣圖塊(最右欄、最底列)可能會比指定的圖塊大小小。
- 網格大小上限為 100x100(10,000 個圖塊)。
- 回應會直接串流 ZIP,因此沒有 JSON 回應主體。使用 curl 搭配
--output儲存檔案。