Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Compress and convert images to WebP or PNG using automatic tool selection (sips, cwebp, ImageMagick, Sharp).
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: baoyu-compress-image3description: Compresses images to WebP (default) or PNG with automatic tool selection. Use when user asks to "compress image", "optimize image", "convert to webp", or reduce image file size.4version: 1.56.15metadata:6openclaw:7homepage: https://github.com/JimLiu/baoyu-skills#baoyu-compress-image8requires:9anyBins:10- bun11- npx12---1314# Image Compressor1516Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).1718## Script Directory1920Scripts in `scripts/` subdirectory. `{baseDir}` = this SKILL.md's directory path. Resolve `${BUN_X}` runtime: if `bun` installed → `bun`; if `npx` available → `npx -y bun`; else suggest installing bun. Replace `{baseDir}` and `${BUN_X}` with actual values.2122| Script | Purpose |23|--------|---------|24| `scripts/main.ts` | Image compression CLI |2526## Preferences (EXTEND.md)2728Check EXTEND.md in priority order — the first one found wins:2930| Priority | Path | Scope |31|----------|------|-------|32| 1 | `.baoyu-skills/baoyu-compress-image/EXTEND.md` | Project |33| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-compress-image/EXTEND.md` | XDG |34| 3 | `$HOME/.baoyu-skills/baoyu-compress-image/EXTEND.md` | User home |3536If none found, use defaults.3738**EXTEND.md supports**: Default format, default quality, keep-original preference.3940## Usage4142```bash43${BUN_X} {baseDir}/scripts/main.ts <input> [options]44```4546## Options4748| Option | Short | Description | Default |49|--------|-------|-------------|---------|50| `<input>` | | File or directory | Required |51| `--output` | `-o` | Output path | Same path, new ext |52| `--format` | `-f` | webp, png, jpeg | webp |53| `--quality` | `-q` | Quality 0-100 | 80 |54| `--keep` | `-k` | Keep original | false |55| `--recursive` | `-r` | Process subdirs | false |56| `--json` | | JSON output | false |5758## Examples5960```bash61# Single file → WebP (replaces original)62${BUN_X} {baseDir}/scripts/main.ts image.png6364# Keep PNG format65${BUN_X} {baseDir}/scripts/main.ts image.png -f png --keep6667# Directory recursive68${BUN_X} {baseDir}/scripts/main.ts ./images/ -r -q 756970# JSON output71${BUN_X} {baseDir}/scripts/main.ts image.png --json72```7374**Output**:75```76image.png → image.webp (245KB → 89KB, 64% reduction)77```7879## Extension Support8081Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.82