compress-imgs

Compress PNG, JPG/JPEG, and WebP images recursively under the project root.

Updated Mar 7, 2026
One-click install
npx skills add https://github.com/agongdai/ai-toolkit --skill compress-imgs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compress-imgs
Source: https://github.com/agongdai/ai-toolkit/tree/main
Command: npx skills add https://github.com/agongdai/ai-toolkit --skill compress-imgs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pngquant, jpegoptim, cwebp, magick, and includes scripts (resource) components.

What problem does it solve?

Reduces the manual effort and bandwidth required to optimize many images in a project by compressing PNG, JPG/JPEG, and WebP assets recursively.

Core Features & Use Cases

  • Batch image compression across a codebase for web performance.
  • Optional WebP conversion to save bandwidth when available.
  • Enforces required tools (pngquant and jpegoptim) and gracefully handles missing optional tools (cwebp or magick).

Quick Start

Run the script to compress images in your project and optionally generate WebP variants.

Frequently Asked Questions about compress-imgs

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

FAQPage Schema
How do I batch compress PNG and JPEG images recursively across a project?

Batch compress PNG and JPEG images recursively by running a bash script that utilizes pngquant and jpegoptim to minimize image sizes across a codebase for web deployment.

Do I need cwebp or ImageMagick installed to convert images to WebP?

cwebp or ImageMagick magick is optionally required to convert images to WebP, as the script gracefully handles missing optional tools while enforcing pngquant and jpegoptim.

What's the best way to minimize image sizes for web deployment in a codebase?

Minimize image sizes for web deployment by executing a single bash command that recursively compresses PNG, JPG, and WebP assets, optionally generating WebP variants to save bandwidth.

Does pngquant work with WebP conversion or only PNG compression?

pngquant handles PNG compression exclusively, while WebP conversion requires optional cwebp or ImageMagick magick dependencies to generate WebP variants from existing images.

Can I shrink WebP images or only PNG and JPG files?

Shrink WebP images alongside PNG and JPG files, as the script recursively compresses all three formats under the project root to reduce bandwidth and manual effort.

Why does the image compression script fail if pngquant is missing?

The script fails because it enforces pngquant and jpegoptim as required dependencies, while only cwebp or ImageMagick magick for WebP conversion are treated as optional tools.