Files
SnapOtter/apps/docs/zh-CN/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.6 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
将图像并排、堆叠或以网格方式拼接,可控制对齐、间距、边框和调整模式。 39333210505a human 87525c98302e

拼接/合并

将多张图像并排、垂直堆叠或以网格排列的方式拼接。支持对齐、间距、边框、圆角和多种调整模式。

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 服务器配置限制,以防止内存耗尽。