baoyu-compress-image

Compress images to WebP or PNG using the best available encoder.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/lihanghang/agent-daily-blog --skill baoyu-compress-image-lihanghang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baoyu-compress-image
Source: https://github.com/lihanghang/agent-daily-blog/tree/main/skills-archive/2026-03-17/baoyu-skills/skills/baoyu-compress-image
Command: npx skills add https://github.com/lihanghang/agent-daily-blog --skill baoyu-compress-image-lihanghang

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Compresses images to WebP (default) or PNG with automatic tool selection, simplifying image optimization without manual tool juggling.

Core Features & Use Cases

  • Automatic tool selection across sips, cwebp, ImageMagick, and Sharp for best results.
  • Single-file and batch processing with optional recursive traversal and quality control.
  • Flexible output formats (WebP, PNG, JPEG) and an option to keep or replace originals.
  • Use Case: You need to reduce a folder of product photos for faster web delivery while preserving quality.

Quick Start

Run the image compressor on a target image to produce a smaller WebP or PNG file using the best available tool.

Frequently Asked Questions about baoyu-compress-image

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

FAQPage Schema
How do I batch compress images to WebP automatically?

Batch compress images to WebP by targeting a directory to process multiple files with automatic tool selection. The tool uses the best available encoder like cwebp or Sharp to reduce file sizes while preserving quality.

What is the best way to compress a folder of PNG images recursively?

Compress a folder of PNG images recursively by enabling optional recursive traversal during batch processing. The system auto-detects the best available local tool like sips or ImageMagick to shrink each file effectively.

Do I need to install Sharp to compress images?

You do not need Sharp to compress images if local tools like sips, cwebp, or ImageMagick are installed. The compressor automatically selects the best available encoder among these options to process your files.

Can I replace original images instead of keeping both files?

You can replace original images by configuring the output settings to not keep the original files. By default, the tool outputs a compressed file alongside the original unless you explicitly choose to replace it.

Does the image compressor work on macOS for WebP conversion?

The image compressor works on macOS for WebP conversion by utilizing the built-in sips tool. It automatically detects and selects sips or other available encoders like cwebp to optimize your images.

What image formats can I output besides WebP?

You can output PNG and JPEG formats besides WebP. The tool allows flexible output format configuration to meet your specific web delivery or storage requirements while applying optimal compression.