baoyu-compress-image

Compress images to WebP or PNG using automatic tool selection.

Updated May 18, 2018
One-click install
npx skills add https://github.com/812lcl/dotfiles --skill baoyu-compress-image-812lcl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: baoyu-compress-image
Source: https://github.com/812lcl/dotfiles/tree/main/.agents/skills/baoyu-compress-image
Command: npx skills add https://github.com/812lcl/dotfiles --skill baoyu-compress-image-812lcl

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Compresses images using best available tool (sips → cwebp → ImageMagick → Sharp).

Core Features & Use Cases

  • Automatic tool selection: sips on macOS, cwebp, ImageMagick, or Sharp fallback.
  • Output formats: default WebP, with PNG option; quality control; directory recursion; JSON output.
  • Use Case: batch-compress multiple images to reduce page load times.

Quick Start

Run the main script on an image to compress it to WebP 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 from the command line?

You can batch compress images to WebP by running the script on a directory tree with recursive processing enabled. It automatically selects the best available tool to reduce file sizes for improved page load times.

Does image compression work with Sharp if cwebp or ImageMagick is missing?

Image compression works with Sharp as a fallback if cwebp or ImageMagick is missing. The script automatically discovers and selects the best available tool, starting with sips on macOS, then cwebp, ImageMagick, and Sharp.

Can I compress a directory of images recursively while keeping the originals?

You can compress a directory recursively while keeping originals by using the optional keep flag. This ensures safe handling of original files while producing optimized WebP or PNG outputs in batch workflows.

What is the best way to convert PNG files to WebP with quality control?

The best way to convert PNG files to WebP is using an automated CLI tool that handles output format selection and quality control. This approach selects the optimal compression utility to produce WebP outputs while maintaining visual fidelity.

How do I generate JSON output for batch image compression workflows?

You generate JSON output for batch image compression by running the script with reporting enabled. This produces JSON data detailing the compression results, which is useful for integrating into automated CLI batch workflows.