baoyu-compress-image

Compress single images or directories into WebP or PNG with configurable quality.

1|Updated Feb 2, 2026
One-click install
npx skills add https://github.com/lisposter/creator --skill baoyu-compress-image
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baoyu-compress-image
Source: https://github.com/lisposter/creator/tree/main/.agents/skills/baoyu-compress-image
Command: npx skills add https://github.com/lisposter/creator --skill baoyu-compress-image

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Image assets often contribute to larger website and app load times. This Skill automatically compresses images to WebP (default) or PNG, selecting the best available tool to minimize file size while preserving visual quality.

Core Features & Use Cases

  • Automatic tool selection: sips → cwebp → ImageMagick → Sharp, choosing the fastest/most compatible compressor per input.
  • Single-file and batch processing: compress one image or an entire directory, with optional recursive traversal and quality targets.
  • Use case: Optimize product images for a storefront, blog thumbnails, or gallery assets with configurable output formats.

Quick Start

Use the baoyu-compress-image skill to compress a single image with default WebP output. npx -y bun ${SKILL_DIR}/scripts/main.ts image.png Directory example: npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75 JSON output: npx -y bun ${SKILL_DIR}/scripts/main.ts image.png --json

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 images to WebP automatically from the command line?

You can compress images to WebP automatically by running the provided script, which selects the best available compressor like cwebp or sharp to reduce file sizes while preserving visual quality.

Can I batch compress an entire directory of PNG images recursively?

Yes, you can batch compress an entire directory of PNG images recursively by passing the directory path with the recursive flag, processing all matching files within the folder structure.

What is the best way to optimize image assets for web load times?

The best way to optimize image assets for web load times is converting them to WebP or PNG using automatic tool selection, which minimizes file sizes while maintaining visual quality.

Does image compression work without installing ImageMagick or sips manually?

Image compression works without manually installing ImageMagick or sips because the pluggable compressor pipeline automatically selects the best available tool, falling back to the sharp dependency if needed.

How do I get JSON output when compressing a single image?

To get JSON output when compressing a single image, append the JSON flag to the command execution, returning structured data regarding the compression results and file details.