baoyu-compress-image_skill

This skill compresses images to WebP by default, with PNG preservation options, using system tools for fast, high-quality web-ready assets.
  • Python

1

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill questnova502/claude-skills-sync --skill baoyu-compress-image

  • SKILL.md4.4 KB

Overview

This skill provides cross-platform image compression with WebP as the default output and optional PNG-to-PNG compression. It prefers native system tools (sips, cwebp, ImageMagick) and falls back to Sharp when needed. The CLI supports single files and directory recursion, with JSON output for automation.

How this skill works

The tool auto-detects available compressors in priority order (sips → cwebp → ImageMagick → Sharp) and uses the best available for each platform. You pass an input file or directory and it converts images to the requested format and quality, replacing or preserving originals depending on flags. Results are printed in human-readable text or emitted as JSON including sizes, ratio, and compressor used.

When to use it

  • Reduce image weight for faster web pages or smaller uploads
  • Batch-compress screenshots, assets, or image libraries with a single command
  • Convert PNGs to efficient WebP while optionally keeping original formats
  • Integrate into build scripts or CI by using JSON output
  • Process directories recursively to compress entire projects

Best practices

  • Test quality on a few representative images before bulk processing and choose quality (0–100) accordingly
  • Use JSON output for CI integration and to aggregate size savings programmatically
  • Keep originals when first running against a large or critical dataset (use --keep)
  • Prefer WebP for web delivery; use --format png or jpeg only when needed for compatibility
  • Run recursive processing on a copy or controlled folder to avoid accidental mass overwrite

Example use cases

  • Compress a single image to WebP at default quality: npx -y bun scripts/main.ts photo.png
  • Batch compress a screenshots folder recursively at quality 75: npx -y bun scripts/main.ts ./screenshots/ -r -q 75
  • Keep original PNGs while producing compressed PNGs: npx -y bun scripts/main.ts screenshot.png -f png --keep
  • Integrate into CI and read compression stats: npx -y bun scripts/main.ts image.png --json | jq '.'
  • Replace originals with WebP for a static site build to reduce total asset size

FAQ

It auto-detects available tools in this order: sips, cwebp, ImageMagick, then Sharp. The first available tool is selected for best performance on your system.

How do I preserve original files?

Use the --keep (or -k) flag to produce compressed outputs without deleting the original files.

Can I process entire directories and subfolders?

Yes. Provide a directory path and add --recursive (or -r) to traverse subdirectories. Use --json for machine-readable summaries.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
baoyu-compress-image skill by questnova502/claude-skills-sync | VeilStrat