Compresses and converts images to WebP or PNG format automatically.
Install
mkdir -p .claude/skills/baoyu-compress-image && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1788" && unzip -o skill.zip -d .claude/skills/baoyu-compress-image && rm skill.zipInstalls to .claude/skills/baoyu-compress-image
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
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.Key capabilities
- →Compress images to WebP or PNG
- →Adjust image quality from 0-100
- →Process directories recursively
- →Convert image formats
- →Output results in JSON format
How it works
The script automatically selects the best available tool from sips, cwebp, ImageMagick, or Sharp to perform the compression. It supports custom configurations via an EXTEND.md file located in project, XDG, or user home directories.
Inputs & outputs
When to use baoyu-compress-image
- →Convert images to WebP
- →Reduce image file size
- →Batch optimize website assets
About this skill
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
${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
# 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.
When not to use it
- →When the environment lacks bun or npx
Prerequisites
Limitations
- →Requires external dependencies like bun or npx
- →Default quality is fixed at 80 unless specified
How it compares
Unlike manual conversion, this tool automates tool selection and supports recursive directory processing with configurable quality settings.
Compared to similar skills
baoyu-compress-image side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| baoyu-compress-image (this skill) | 11 | 3mo | Review | Beginner |
| audit | 0 | 3mo | No flags | Intermediate |
| render-performance | 0 | 5mo | No flags | Advanced |
| ui-design-aesthetics | 0 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by JimLiu
View all by JimLiu →You might also like
audit
educlopez
Technical UI audit — a11y, performance, responsive. Produces a prioritized findings table. Invoke when the user asks for audit on their UI, or mentions 'audit' alongside design / UI / frontend work.
render-performance
BrainAV
Rules for implementing GPU-accelerated rendering (WebGL/WebGPU), optimizing canvas operations, and ensuring a stable 60fps UI for real-time music performance.
ui-design-aesthetics
NickCrew
Generates high-quality, non-generic UI designs with a focus on performance, progressive disclosure, and distinctive aesthetics.
mobile-ux-review
vctb12
Use for mobile-first redesigns, tracker UX work, homepage/calculator/shops polish, Arabic/RTL mobile review.
nextjs-developer
zenobi-us
Expert Next.js developer mastering Next.js 14+ with App Router and full-stack features. Specializes in server components, server actions, performance optimization, and production deployment with focus on building fast, SEO-friendly applications.
angular
sickn33
Modern Angular (v20+) expert with deep knowledge of Signals, Standalone Components, Zoneless applications, SSR/Hydration, and reactive patterns. Use PROACTIVELY for Angular development, component architecture, state management, performance optimization, and migration to modern patterns.