baoyu-compress-image

Compresses images to WebP, PNG, or JPEG using the best available local tool.

2|Updated May 30, 2026
One-click install
npx skills add https://github.com/virahitvin8/crafty-gis --skill baoyu-compress-image-virahitvin8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baoyu-compress-image
Source: https://github.com/virahitvin8/crafty-gis/tree/main/GIT_STAR/assignment-generator/antigravity-skills-main/antigravity-skills-main/skills/baoyu-compress-image
Command: npx skills add https://github.com/virahitvin8/crafty-gis --skill baoyu-compress-image-virahitvin8

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sharp, and includes scripts (resource) components.

What problem does it solve? Large image files slow down websites and consume storage, and manually converting or compressing them one by one is tedious. This Skill compresses single images or entire directories to WebP, PNG, or JPEG with automatic selection of the best available compression tool on your system. ## Core Features & Use Cases - Automatic Tool Selection: Detects and uses sips, cwebp, ImageMagick, or Sharp depending on what is installed, so it works across macOS and other environments. - Batch and Recursive Processing: Compress a single file or walk an entire directory tree with the recursive flag, with per-file and summary size reduction reporting. - Configurable Output: Control format, quality (0-100), output path, whether to keep originals, and JSON output for scripting pipelines. - Use Case: Before deploying a website, run the Skill recursively over your assets folder to convert all PNGs to WebP at quality 75 and see the total size reduction in one summary line. ## Quick Start Ask the AI to compress the image hero.png to WebP format at quality 80 using this Skill.

Frequently Asked Questions about baoyu-compress-image

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compress an image to WebP from the command line?

Run the main.ts script with bun or npx, passing the image path as input. By default it outputs WebP at quality 80, and you can adjust with the -f and -q flags for format and quality.

How do I batch compress all images in a folder?

Pass a directory path as the input and add the -r flag to process subdirectories recursively. The script finds all supported image files (png, jpg, jpeg, webp, gif, tiff) and reports total size reduction.

Which image compression tool does it use: cwebp, ImageMagick, or Sharp?

It auto-detects the best available tool: cwebp is preferred for WebP output, sips is used on macOS for PNG/JPEG, ImageMagick is a fallback, and Sharp is the final fallback via npm.

Does compressing an image delete the original file?

By default the original is renamed with an _original suffix rather than deleted. Use the -k or --keep flag to keep the original untouched, in which case the output gets a -compressed suffix when formats match.

What image formats are supported for compression?

Input supports PNG, JPG, JPEG, WebP, GIF, and TIFF files. Output formats are WebP (default), PNG, and JPEG, selectable with the --format option.