Files
SnapOtter/apps/docs/zh-CN/tools/image/gif-webp.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

1.7 KiB
Raw Blame History

description, i18n_source_hash, i18n_provenance, i18n_output_hash
description i18n_source_hash i18n_provenance i18n_output_hash
在动画 GIF 与 WebP 之间互相转换,保留所有帧。 20946e5001cb human 7c7af582111a

GIF/WebP 转换器

在动画 GIF 文件与 WebP 之间互相转换,保留所有帧和动画时序。WebP 动画通常比等效的 GIF 小 25-35%。

API 端点

POST /api/v1/tools/image/gif-webp

接受包含一个 GIF 或 WebP 文件的 multipart 表单数据,以及一个 JSON settings 字段。

参数

参数 类型 是否必填 默认值 说明
quality integer 80 WebP 编码的输出质量(1-100
lossless boolean false 使用无损 WebP 压缩
resizePercent integer 100 按百分比缩放输出(10-100

请求示例

curl -X POST http://localhost:1349/api/v1/tools/image/gif-webp \
  -H "Authorization: Bearer si_your-api-key" \
  -F "file=@animation.gif" \
  -F 'settings={"quality": 85, "resizePercent": 50}'

响应示例

{
  "jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/animation.webp",
  "originalSize": 3500000,
  "processedSize": 2200000
}

说明

  • 仅接受 .gif.webp 文件。此工具不支持其他图像格式。
  • 转换方向是自动的:GIF 输入生成 WebP 输出,WebP 输入生成 GIF 输出。
  • qualitylossless 选项仅在编码为 WebP 时适用。转换为 GIF 时,输出使用标准 GIF 调色板。
  • 使用 resizePercent 来缩小大型动画的尺寸(以及文件大小)。