image-optimizer
Optimize and compress images for web use. Reduces file sizes of JPEG, PNG, GIF images using lossy/lossless compression. Can resize images to maximum dimensions, convert to WebP format, and process entire directories recursively. Use when images are too large for web, need compression, or need format conversion.
Best use case
image-optimizer is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Optimize and compress images for web use. Reduces file sizes of JPEG, PNG, GIF images using lossy/lossless compression. Can resize images to maximum dimensions, convert to WebP format, and process entire directories recursively. Use when images are too large for web, need compression, or need format conversion.
Teams using image-optimizer should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/image-optimizer/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How image-optimizer Compares
| Feature / Agent | image-optimizer | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Optimize and compress images for web use. Reduces file sizes of JPEG, PNG, GIF images using lossy/lossless compression. Can resize images to maximum dimensions, convert to WebP format, and process entire directories recursively. Use when images are too large for web, need compression, or need format conversion.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Image Optimizer Compress and optimize images for web delivery, similar to Squoosh. ## Quick Start ```bash # Ensure dependencies are installed scripts/install-deps.sh # Optimize images scripts/imgopt.sh [OPTIONS] <files or directories> ``` ## Common Use Cases ### Optimize a single image ```bash scripts/imgopt.sh photo.jpg ``` ### Compress all images in a folder ```bash scripts/imgopt.sh images/ ``` ### Resize and compress for web (recommended for large images) ```bash scripts/imgopt.sh -q 80 -w 1920 images/ ``` ### Create WebP versions (best compression for modern browsers) ```bash scripts/imgopt.sh --webp images/ ``` ### Process recursively and keep originals ```bash scripts/imgopt.sh -r --keep --webp ./website/images/ ``` ### Output to a different directory ```bash scripts/imgopt.sh -o optimized/ *.jpg *.png ``` ### Preview what would happen (dry run) ```bash scripts/imgopt.sh -n -r images/ ``` ## Options Reference | Option | Description | Default | |--------|-------------|--------| | `-q, --quality N` | Quality level 1-100 | 80 | | `-w, --max-width N` | Maximum width in pixels | unlimited | | `-h, --max-height N` | Maximum height in pixels | unlimited | | `-o, --output DIR` | Output directory | in-place | | `--webp` | Also create WebP versions | off | | `--keep` | Keep originals (save as .opt.ext) | off | | `-r, --recursive` | Process directories recursively | off | | `-n, --dry-run` | Show what would be done | off | | `-v, --verbose` | Show detailed progress | off | ## Supported Formats - **Input**: JPEG, PNG, GIF, BMP, TIFF - **Output**: Same format (optimized) + optional WebP ## Recommended Settings by Use Case | Use Case | Command | |----------|--------| | Blog images | `-q 80 -w 1200 --webp` | | Hero/banner images | `-q 85 -w 1920 --webp` | | Thumbnails | `-q 75 -w 400` | | E-commerce products | `-q 85 -w 1000 --webp` | | Maximum compression | `-q 60 -w 1920 --webp` | ## Tips 1. **Always test on copies first** - Use `--keep` or `-o output/` until you're happy with results 2. **WebP is best for web** - Creates files typically 25-35% smaller than optimized JPEG 3. **Quality 80 is a good default** - Below 70 you may notice artifacts 4. **Resize matters most** - A 4000px image resized to 1920px will be much smaller regardless of compression See [references/REFERENCE.md](references/REFERENCE.md) for detailed technical information.
Related Skills
context-optimizer
Analyzes Copilot Chat debug logs, agent definitions, skills, and instruction files to audit context window utilization. Provides log parsing, turn-cost profiling, redundancy detection, hand-off gap analysis, and optimization recommendations. Use when optimizing agent context efficiency, identifying where to add subagent hand-offs, or reducing token waste across agent systems.
all-images-ai-automation
Automate All Images AI tasks via Rube MCP (Composio). Always search tools first for current schemas.
ai-image-generator
使用 ModelScope 等平台生成 AI 图像。当用户需要生成图像、设计图标、创建角色立绘,或需要帮助编写 AI 绘画提示词时使用此技能。支持直接生成图像和仅优化提示词两种模式。
agentv-prompt-optimizer
Iteratively optimize prompt files against AgentV evaluation datasets by analyzing failures and refining instructions.
xhs-images
Xiaohongshu (Little Red Book) infographic series generator with multiple style options. Breaks down content into 1-10 cartoon-style infographics. Use when user asks to create "小红书图片", "XHS images", or "RedNote infographics".
x-image-cards
Create X/Twitter cards that look like images, not marketing banners. Use when asked to "create OG images", "set up X cards", "make social cards", or "twitter card without text".
wiro-image-fill
Generate missing or placeholder images in a project by calling the Wiro image generation API, saving assets under public/assets generated folders, and producing a JSON mapping. Use when you see empty img src, placeholder.png, or other image gaps that need real assets.
seedream-image-generator
Generate images using the Doubao SeeDream API based on text prompts. Use this skill when users request AI-generated images, artwork, illustrations, or visual content creation. The skill handles API calls, downloads generated images to the project's /pic folder, and supports batch generation of up to 4 sequential images.
placeholder-images
Rule to use placekitten.com for placeholder images in seed data.
og-image-generator
Generate and optimize Open Graph meta images for social media sharing. Use this skill when building web applications that need dynamic OG image generation with support for Vercel's @vercel/og library, pre-generated image storage, and social media optimization (Twitter Cards, Facebook, LinkedIn). Handles dynamic routes, performance optimization, and includes best practices for crawler compatibility and testing.
nanobanana-image
Nano Banana (Google Gemini API) を使って画像を生成・編集するスキル。「画像を生成して」「イラストを作って」「○○の絵を描いて」「画像を作成」「この画像を編集して」「この画像をもとに○○を作って」「generate an image」「create a picture」「edit this image」などの依頼があった場合に使用。テキストからの生成、参照画像からの生成、画像編集、Google検索グラウンディングによる最新情報を反映した画像生成に対応。「最新の○○」「トレンドを反映」「リアルタイム情報」といった依頼にも対応可能。
nano-image-generate
Generate images using Nano Banana (Flash) or Nano Banana Pro. Use 'flash' for speed/efficiency and 'pro' for high quality, text rendering, and complex prompt adherence. Triggers include 'generate image', 'create logo', 'fast image', 'high quality image'.