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

52 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
description: "在动画 GIF 与 WebP 之间互相转换,保留所有帧。"
i18n_source_hash: 20946e5001cb
i18n_provenance: human
i18n_output_hash: 7c7af582111a
---
# GIF/WebP 转换器 {#gif-webp-converter}
在动画 GIF 文件与 WebP 之间互相转换,保留所有帧和动画时序。WebP 动画通常比等效的 GIF 小 25-35%。
## API 端点 {#api-endpoint}
`POST /api/v1/tools/image/gif-webp`
接受包含一个 GIF 或 WebP 文件的 multipart 表单数据,以及一个 JSON `settings` 字段。
## 参数 {#parameters}
| 参数 | 类型 | 是否必填 | 默认值 | 说明 |
|-----------|------|----------|---------|-------------|
| quality | integer | 否 | `80` | WebP 编码的输出质量(1-100 |
| lossless | boolean | 否 | `false` | 使用无损 WebP 压缩 |
| resizePercent | integer | 否 | `100` | 按百分比缩放输出(10-100) |
## 请求示例 {#example-request}
```bash
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}'
```
## 响应示例 {#example-response}
```json
{
"jobId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"downloadUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/animation.webp",
"originalSize": 3500000,
"processedSize": 2200000
}
```
## 说明 {#notes}
- 仅接受 `.gif``.webp` 文件。此工具不支持其他图像格式。
- 转换方向是自动的:GIF 输入生成 WebP 输出,WebP 输入生成 GIF 输出。
- `quality``lossless` 选项仅在编码为 WebP 时适用。转换为 GIF 时,输出使用标准 GIF 调色板。
- 使用 `resizePercent` 来缩小大型动画的尺寸(以及文件大小)。