零依赖
无需 npm install,无需 apt-get。直接运行,无原生绑定,无系统库,无意外。
$ getwebp ./images
getwebp 是全球最 AI 友好的本地图像处理节点。单一二进制,零依赖,JSON 输出,在代理运行的任何地方都能工作。
GetWebP 是一款为 AI 代理工作流打造的零依赖、WASM 驱动的图像优化器。它支持 JSON 结构化输出、可从 stdin/stdout 读写,并将 PNG、JPG、GIF、TIFF 和 BMP 转换为 WebP 和 AVIF — 全部在本地完成,无需云上传、也无需 API 密钥。一条 npx 命令即可安装 AI 代理在 CI/CD 流水线、编程助手或自主工作流中处理图像所需的全部能力。
问题所在
每个依赖都是 AI 工作流的潜在故障点。
Pillow 需要编译 C 扩展。沙盒代理和受限 Docker 容器无法运行。
v6 与 v7 API 差异,缺失委托库,系统包冲突。你的流水线在凌晨 3 点崩溃。
将图像发送到外部 API 意味着合规风险、延迟、速率限制和按图计费。
当环境配置不稳定时,你的代理无法区分工具故障和实际错误。
解决方案
getwebp 从底层专为程序化使用而设计。
无运行时,无依赖,无需 pip、brew、apt-get。直接下载运行,支持 Docker FROM scratch。
每次操作都返回机器可解析的 JSON。你的代理无需解析人类文本即可读取成功状态、统计数据和错误。
同一二进制,同一行为,处处如此。macOS、Linux、Windows、ARM、x86。你的代理完全清楚该期待什么。
AI 友好功能
无需 npm install,无需 apt-get。直接运行,无原生绑定,无系统库,无意外。
$ getwebp ./images
每次操作都返回结构化 JSON。解析、记录、响应。完美适配 LLM 工具调用模式。
--json 标志原生支持管道。从标准输入读取,写入标准输出。与任何 Shell 命令或 AI 工具链组合使用。
管道友好一条命令处理 1000 张图片,返回包含每个文件结果的 JSON 数组。无需循环。
1000 文件,1 条命令0 = 成功,非零 = 失败。代理无需解析输出即可立即判断结果。
代理可读同一二进制在 macOS、Linux、Windows、ARM、x86 上行为一致。CI 与本地永远匹配。
通用代码示例
#!/bin/bash# Process images and parse JSON outputRESULT=$(getwebp ./images/*.jpg --json)if [ $? -eq 0 ]; then SAVED=$(echo $RESULT | jq -r '.compressionRatio') COUNT=$(echo $RESULT | jq -r '.processed') echo "✓ Processed $COUNT files, saved $SAVED"else echo "✗ Error: $(echo $RESULT | jq -r '.error')" exit 1fiimport subprocessimport jsonresult = subprocess.run( ["getwebp", "./images", "--json"], capture_output=True, text=True)if result.returncode == 0: data = json.loads(result.stdout) print(f"✓ Processed {data['processed']} files") print(f" Saved {data['compressionRatio']} ({data['totalInputSize']} → {data['totalOutputSize']})")else: error = json.loads(result.stderr) raise RuntimeError(f"getwebp failed: {error['error']}")- name: Optimize images run: | npx getwebp@latest ./public/images \ --json > optimization-report.json SAVED=$(cat optimization-report.json | jq -r '.compressionRatio') echo "Images optimized: $SAVED smaller"- name: Upload report uses: actions/upload-artifact@v4 with: name: image-optimization-report path: optimization-report.jsonFROM node:20-alpine# getwebp is a single binary — no system deps neededRUN npx getwebp@latest --install-binary /usr/local/bin/getwebpCOPY ./images /app/imagesRUN getwebp /app/images --json > /app/result.json \ && cat /app/result.json | jq '.compressionRatio'传入 --json 时,每次操作都返回代理可推理的结构化数据。
{ "success": true, "operation": "convert", "input": { "file": "hero.jpg", "size": "1.2 MB", "format": "JPEG" }, "output": { "file": "hero.webp", "size": "142 KB", "format": "WebP" }, "saved": "88%", "duration": "0.3s" }
无需自定义适配器。只要能运行 Shell 命令,就能与 getwebp 配合使用。
Works with any tool that can run a shell command
与其他程序化工作流图像处理工具的比较。
| Features | getwebpBest for AI | ImageMagick | Pillow | Cloudinary API | sharp (Node) |
|---|---|---|---|---|---|
| 零依赖 | |||||
| JSON 输出 | |||||
| 100% 离线/本地 | |||||
| 单一二进制 | |||||
| 可预测退出码 | |||||
| 批量 JSON 数组输出 | |||||
| 跨平台一致 | |||||
| AI 代理就绪 |
在将图像发送到视觉模型之前,调整大小并压缩以降低高达 80% 的 token 成本。getwebp 用一条返回 JSON 的命令处理整批图像。
Workflow
Example
# Reduce image size before sending to GPT-4V
result = subprocess.run([
"getwebp", image_path,
"--resize", "1024x1024",
"--json"
], capture_output=True, text=True)
data = json.loads(result.stdout)
# Tokens saved: ~80% for typical product photos常见问题
Every GetWebP product runs on the same WASM converter — pick the surface that fits your workflow.
Model Context Protocol server that gives Claude, Cursor, and Windsurf local image conversion.
Zero-dependency command-line converter. One npx command, runs in any terminal or CI pipeline.
Local-first integration surfaces — CLI in your shell, MCP in your agent. Zero AWS bill.