Compress Images
Compress images for web/SEO performance using cwebp. Use when optimizing images for faster page loads, reducing file sizes, or converting JPG/PNG to WebP format.
MCP get_skill({ skillId: "image-compression-skill-b7197187" })Use this skill with your agent
Create a free account and connect via MCP
# Image Compression Skill Compress all images in `$ARGUMENTS` (or `app/assets/images/content/` if no path provided) to WebP format, optimized for SEO performance (target: under 100KB per image). ## Process 1. **Create originals folder** - Create `originals/` subfolder inside the target directory and move source files there. Never destroy source files. 2. **Compress each image** (JPG, PNG, GIF) from `originals/` to the parent directory as `.webp` 3. **Iterate until all images are under 100KB** - check sizes after each pass, re-compress any that exceed the target 4. **Report results** with before/after sizes 5. **Update references** in content files from old extensions to `.webp` ## File Structure ``` target-directory/ ├── originals/ # High-quality source files preserved here │ ├── hero.jpg │ └── feature.png ├── hero.webp # Compressed, web-optimized └── feature.webp ``` ## Iterative Compression Algorithm **IMPORTANT:** Keep compressing until ALL images are under 100KB. Check sizes after each pass and re-compress any that exceed the target. ### Step 1: Initial pass (q 70) ```bash cwebp -q 70 -resize 1200 0 originals/image.jpg -o image.webp ls -lh image.webp # Check size ``` ### Step 2: If still over 100KB, reduce quality progressively ```bash # Try these in order until under 100KB: cwebp -q 60 -resize 1200 0 originals/image.jpg -o image.webp cwebp -q 50 -resize 1200 0 originals/image.jpg -o image.webp cwebp -q 45 -resize 1200 0 originals/image.jpg -o image.webp cwebp -q 40 -resize 1200 0 originals/image.jpg -o image.webp cwebp -q 35 -resize 1200 0 originals/image.jpg -o image.webp ``` ### Step 3: For stubborn images, also reduce dimensions ```bash # If q 35 at 1200px is still over 100KB, reduce to 1000px: cwebp -q 30 -resize 1000 0 originals/image.jpg -o image.webp cwebp -q 25 -resize 1000 0 originals/image.jpg -o image.webp ``` ## Real-World Results (Reference) From actual compression run on content images: | Image | Original | First Try | Final | Settings Used | |-------|----------|-----------|-------|---------------| | waves.jpg | 198KB | 33KB | 33KB | q 70, 1200px (1 pass) | | calendar.jpg | 246KB | 42KB | 42KB | q 70, 1200px (1 pass) | | floating.jpg | 230KB | 43KB | 43KB | q 70, 1200px (1 pass) | | cash.jpg | 409KB | 88KB | 88KB | q 70, 1200px (1 pass) | | knot.jpg | 395KB | 96KB | 96KB | q 70, 1200px (1 pass) | | floating-dark.jpg | 414KB | 94KB | 94KB | q 70, 1200px (1 pass) | | keyboard2.jpg | 459KB | 102KB | 102KB | q 70, 1200px (1 pass, acceptable) | | **perpetual.jpg** | 565KB | 130KB | **96KB** | q 40, 1200px (3 passes) | | **keyboard.jpg** | 718KB | 196KB | **98KB** | q 25, 1000px (5 passes) | ### Key Insights 1. **Most images** (under 500KB source) compress fine with default settings (q 70, 1200px) 2. **Large detailed images** (500KB+) often need multiple passes 3. **Very large images** (700KB+) may need both lower quality AND smaller dimensions 4. **Keyboard/tech photos** with fine detail are hardest to compress - expect 4-5 passes 5. **Soft/blurry images** compress much better than sharp detailed ones ## After Compression 1. **Verify ALL files under 100KB**: `ls -lh *.webp` - re-run compression on any exceeding target 2. Update content files referencing old extensions (.jpg, .png) to use .webp 3. Test that images render correctly in the application 4. Original files remain in `originals/` folder for future reference or re-compression
Related Skills
More skills in Design, Media & Creative
Ableton Lom
Ableton Live Object Model (LOM) API reference for Python Remote Scripts and control surface development.
Accessibility Compliance
Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.
Adobe Illustrator Scripting
Write, debug, and optimize Adobe Illustrator automation scripts using ExtendScript (JavaScript/JSX). Use when creating or modifying scripts that manipulate documents, layers, paths, text frames, colors, symbols, artboards, or any Illustrator DOM objects. Covers the complete JavaScript object model, coordinate system, measurement units, export workflows, and scripting best practices.
🎬 AI Cinema Director Skill
Direct high-fidelity cinematic video with AI — translates creative intent into technical cinematographic directives for Veo3, Kling, and Luma video models via muapi.ai
AI Clipping
Turn a long video into N viral-ready short clips with a single managed API call. Wraps muapi.ai's `/ai-clipping` endpoint, which handles transcription, highlight ranking through a virality framework (hook / emotional peak / opinion bomb / revelation / conflict / quotable / story peak / practical value), overlap dedupe, and vertical face-tracking auto-crop server-side. No local Whisper, no local LLM, no GPU.
AI Workflow Builder
Build, run, and visualize multi-step AI generation workflows. The AI architect translates natural language descriptions into connected node graphs — chain image generation, video creation, enhancement, and editing into automated pipelines.
Explore Other Categories
Skills from other categories with shared topics
Customer Empathy
Deep-dive into customer empathy and user journey thinking. Use when designing onboarding, improving UX, planning features, or trying to understand how to delight users faster.
Download Video
Download videos from social media URLs (X/Twitter, YouTube, Instagram, TikTok, etc.) using yt-dlp. Use when saving a video locally, extracting content for transcription, or archiving video references.
Transcribe Video
Generate subtitles (SRT/VTT) and plain text transcripts from video or audio files using AWS Transcribe. Use when creating captions, extracting spoken content, generating transcripts for notes, or making video content searchable.