baoyu-compress-image

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.

Author

Install

Hot:12

Download and extract to your skills directory

Copy command and send to OpenClaw for auto-install:

Download and install this skill https://openskills.cc/api/download?slug=jimliu-skills-baoyu-compress-image&locale=en&source=copy

baoyu-compress-image - Image Compression and Format Conversion Tool

Skill Overview


baoyu-compress-image is an intelligent image compression command-line tool. It supports converting images to WebP, PNG, or JPEG formats, and automatically selects the best compression engine (sips → cwebp → ImageMagick → Sharp) to help you quickly reduce image file size.

Use Cases

  • Website Asset Optimization

  • Batch-compress image assets in projects to reduce page load size. It supports recursively processing the entire directory structure and automatically converting images to WebP for the best compression ratio.

  • Image Format Standardization

  • Convert mixed-format image assets to WebP or a specified format for easier project management and CDN distribution. Choose whether to keep the original files or replace them directly.

  • Bulk Processing for Content Creators

  • Batch-compress and adjust quality for blog post images, e-commerce product images, or design mockups to reduce storage usage and transmission bandwidth, improving the user experience.

    Core Features

  • Automatic Intelligent Tool Selection

  • Automatically detects and uses the best available compression engine on your system: first macOS-native sips, then cwebp, ImageMagick, or Sharp. No manual dependency installation is required.

  • Flexible Quality Control and Format Conversion

  • Supports quality settings from 0 to 100, with a default of 80. You can freely convert between WebP, PNG, and JPEG. Use the --keep option to decide whether to retain the original files.

  • Recursive Directory Processing and JSON Output

  • Use -r to recursively process all images in subdirectories. With --json, output structured compression results, making it easy to integrate into CI/CD workflows or automation scripts.

    Frequently Asked Questions

    What image formats does baoyu-compress-image support?


    The tool supports common image formats as inputs and outputs, including PNG, JPEG, and JPG. The output format can be selected as WebP (default), PNG, or JPEG. The supported input formats depend on the selected compression engine and typically cover common Web image formats.

    How do I batch-compress all images in a folder?


    Use the -r or --recursive parameter to recursively process all images in the specified directory and its subdirectories. For example:
    npx -y bun ${SKILL_DIR}/scripts/main.ts ./images/ -r
    This will process all images under the images directory.

    Can I see how much space was saved after compression?


    Yes. Use the --json parameter to get structured compression results showing the original file size, compressed size, and the percentage reduction. In normal mode, the terminal will also display compression stats such as (245KB → 89KB, 64% reduction).