| 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
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
bun {baseDir}/scripts/compress.ts image.png
bun {baseDir}/scripts/compress.ts image.png -q 90
bun {baseDir}/scripts/compress.ts image.png --lossless
bun {baseDir}/scripts/compress.ts image.png -k
bun {baseDir}/scripts/compress.ts "images/*.png"
bun {baseDir}/scripts/compress.ts image.png -o output.webp
Output:
image.png → image.webp (1024KB → 89KB, 91% reduction)