webp-skill
Compresses PNG images to WebP format using ffmpeg. Use when user asks to "convert png to webp", "compress to webp", "png转webp", "压缩成webp", or reduce PNG file size.
来源信息
- 仓库
- yang0/webp-skill
- 最近来源活动
- 2026年7月5日 23:35
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 0
- 分支
- 0
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- webp-skill
- description
- Compresses PNG images to WebP format using ffmpeg. Use when user asks to "convert png to webp", "compress to webp", "png转webp", "压缩成webp", or reduce PNG file size.
- version
- 1.0.0
- metadata
- {"requires":{"anyBins":["ffmpeg","bun"]}}
# PNG → WebP Compressor
Converts PNG images to WebP format via ffmpeg. Simple, lossy/lossless WebP encoding with configurable quality.
## Script Directory
Scripts in `scripts/` subdirectory. `{baseDir}` = this SKILL.md's directory path. Replace `{baseDir}` with actual value.
| Script | Purpose |
|--------|---------|
| `scripts/compress.ts` | PNG → WebP conversion CLI |
## Usage
```bash
bun {baseDir}/scripts/compress.ts <input> [options]
```
## Options
| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| `<input>` | | PNG file path(s) — supports glob patterns | Required |
| `--output` | `-o` | Output file or directory | Same path, .webp ext |
| `--quality` | `-q` | Quality 0–100 | 80 |
| `--lossless` | `-l` | Lossless WebP encoding (ignores quality) | false |
| `--keep` | `-k` | Keep original PNG | false |
## Examples
```bash
# Basic conversion (quality 80)
bun {baseDir}/scripts/compress.ts image.png
# High quality
bun {baseDir}/scripts/compress.ts image.png -q 90
# Lossless
bun {baseDir}/scripts/compress.ts image.png --lossless
# Keep original
bun {baseDir}/scripts/compress.ts image.png -k
# Convert all PNGs in a directory
bun {baseDir}/scripts/compress.ts "images/*.png"
# Custom output path
bun {baseDir}/scripts/compress.ts image.png -o output.webp
```
**Output**:
```
image.png → image.webp (1024KB → 89KB, 91% reduction)
```
在 GitHub 查看