baoyu-compress-image — Claude Code skill: what it does, how to install
Compresses images into WebP or PNG using local tools like sips and cwebp. Handy for optimizing assets directly inside your repository.
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a claude-codeWhat baoyu-compress-image does
The skill runs scripts/main.ts and selects the best tool installed on your machine following a set order: sips, cwebp, ImageMagick, or Sharp. By default, it converts images to WebP at quality 80 and overwrites the original file. If you want to keep the source asset, pass the --keep option.
Execution requires bun or npx. The CLI handles single files or processes directories recursively with the -r flag. Custom preferences for output format and default quality can be set up in an EXTEND.md file within the repository or your user home directory.
Install it if you regularly prepare web assets and want to avoid manual conversions in desktop apps.
What it helps with
- convert PNG or JPEG assets to WebP
- compress a folder of images recursively
- reduce image file size before committing code
- route compression through the best available tool on the machine
Example prompts for the agent
- Compress images in ./public/images recursively with quality 75
- Convert hero.png to webp and keep the original file
- Optimize preview.png to reduce its file size
How to install baoyu-compress-image
1Skills CLI (Vercel)
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a claude-code2Manually: put the files in place
~/.claude/skills/baoyu-compress-image/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/baoyu-compress-image/
1Skills CLI (Vercel)
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a codex2Manually: put the files in place
.agents/skills/baoyu-compress-image/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a cursor2Manually: put the files in place
.cursor/skills/baoyu-compress-image/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install JimLiu/baoyu-skills baoyu-compress-image2Manually: put the files in place
.github/skills/baoyu-compress-image/SKILL.md1Skills CLI (Vercel)
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a gemini-cli2Platform CLI
gemini skills install https://github.com/JimLiu/baoyu-skills --path skills/baoyu-compress-imageManually: put the files in place
.devin/skills/baoyu-compress-image/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set18
The whole set →Similar
Questions about baoyu-compress-image
How to install baoyu-compress-image in Claude Code?
Run npx skills add JimLiu/baoyu-skills --skill baoyu-compress-image -a claude-code in your terminal.
What does baoyu-compress-image require to run?
It needs either bun or npx installed. Image processing relies on whichever local tool is present: sips, cwebp, ImageMagick, or Sharp.
Does baoyu-compress-image overwrite original files?
Yes, by default it replaces the source file with the compressed output. Use the --keep flag if you want to retain the original image.
Source text
SKILL.md · MIT
---
name: baoyu-compress-image
description: 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.
version: 1.56.1
metadata:
openclaw:
homepage: https://github.com/JimLiu/baoyu-skills#baoyu-compress-image
requires:
anyBins:
- bun
- npx
---
# Image Compressor
Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).
## Script Directory
Scripts 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.
| Script | Purpose |
|--------|---------|
| `scripts/main.ts` | Image compression CLI |
## Preferences (EXTEND.md)
Check EXTEND.md in priority order — the first one found wins:
| Priority | Path | Scope |
|----------|------|-------|
| 1 | `.baoyu-skills/baoyu-compress-image/EXTEND.md` | Project |
| 2 | `${XDG_CONFIG_HOME:-$HOME/.config}/baoyu-skills/baoyu-compress-image/EXTEND.md` | XDG |
| 3 | `$HOME/.baoyu-skills/baoyu-compress-image/EXTEND.md` | User home |
If none found, use defaults.
**EXTEND.md supports**: Default format, default quality, keep-original preference.
## Usage
```bash
${BUN_X} {baseDir}/scripts/main.ts <input> [options]
```
## Options
| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| `<input>` | | File or directory | Required |
| `--output` | `-o` | Output path | Same path, new ext |
| `--format` | `-f` | webp, png, jpeg | webp |
| `--quality` | `-q` | Quality 0-100 | 80 |
| `--keep` | `-k` | Keep original | false |
| `--recursive` | `-r` | Process subdirs | false |
| `--json` | | JSON output | false |
## Examples
```bash
# Single file → WebP (replaces original)
${BUN_X} {baseDir}/scripts/main.ts image.png
# Keep PNG format
${BUN_X} {baseDir}/scripts/main.ts image.png -f png --keep
# Directory recursive
${BUN_X} {baseDir}/scripts/main.ts ./images/ -r -q 75
# JSON output
${BUN_X} {baseDir}/scripts/main.ts image.png --json
```
**Output**:
```
image.png → image.webp (245KB → 89KB, 64% reduction)
```
## Extension Support
Custom configurations via EXTEND.md. See **Preferences** section for paths and supported options.
© JimLiu · MIT · JimLiu/baoyu-skills