Files
SnapOtter/apps/docs/zh-TW/tools/image/stitch.md
T
SnapOtterandGitHub 4963ab3bbd feat(docs-i18n): translate all documentation into 20 languages
All 181 docs markdown files translated into 20 languages (apps/docs/<locale>/**). Companion to the i18n code PR; admin-merged because the file count exceeds GitHub's per-PR CI trigger limit. Validated by pnpm i18n:check (all surfaces, 0 stale/missing) and a clean all-locale docs build.
2026-07-11 13:52:47 +08:00

2.7 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
將影像並排、堆疊或以網格方式接合,並可控制對齊、間隙、邊框與縮放模式。 39333210505a human 450bbb6647a7

接合 / 合併

將多張影像並排接合、垂直堆疊或以網格排列。支援對齊、間隙、邊框、圓角半徑以及多種縮放模式。

API 端點

POST /api/v1/tools/image/stitch

參數

參數 型別 必填 預設值 說明
direction string "horizontal" 版面方向:horizontalverticalgrid
gridColumns integer 2 當方向為 grid 時的欄數(2 至 100
resizeMode string "fit" 影像的縮放方式:fitoriginalstretchcrop
alignment string "center" 交叉軸對齊:startcenterend
gap number 0 影像之間的間隙(像素)(0 至 1000)
border number 0 外邊框寬度(像素)(0 至 500
cornerRadius number 0 套用於最終輸出的圓角半徑(0 至 500)
backgroundColor string "#FFFFFF" 背景/邊框顏色,以十六進位表示(例如 #FF0000
format string "png" 輸出格式:pngjpegwebpavifjxl
quality number 90 輸出品質(1 至 100

範例請求

curl -X POST http://localhost:1349/api/v1/tools/image/stitch \
  -F "file=@image1.png" \
  -F "file=@image2.png" \
  -F "file=@image3.png" \
  -F 'settings={"direction":"horizontal","resizeMode":"fit","gap":10,"backgroundColor":"#FFFFFF","format":"png"}'

範例回應

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/stitch.png",
  "originalSize": 1234567,
  "processedSize": 987654
}

注意事項

  • 至少需要 2 張影像。在 multipart 請求中上傳多個影像檔案。
  • 支援 HEIC、RAW、PSD 與 SVG 輸入格式(自動解碼)。
  • 縮放模式:
    • fit - 沿接合軸縮放影像以配合最小尺寸。
    • original - 保留原始尺寸(可能產生不平整的邊緣)。
    • stretch - 強制影像配合最小尺寸,不保留長寬比。
    • crop - 以覆蓋方式裁切影像以配合最小尺寸。
  • grid 模式下,儲存格大小會設為所有影像尺寸的中位數。
  • cornerRadius 會套用於整個最終輸出,而非個別影像。
  • 畫布大小受 MAX_CANVAS_PIXELS 伺服器設定限制,以防止記憶體耗盡。