AGENT SKILL

img-optimizer

Compress, resize, and convert images using ImageMagick. Batch process with quality control.

License 许可
MIT
最近更新
2026-08-23
Stars
★ 1
Forks
0

01 前言 Front Matter

description
Compress, resize, and convert images using ImageMagick. Batch process with quality control.

02 资源文件 2

03 SKILL.md 正文

Image Optimizer

Optimize images via compression, resizing, and format conversion.

Use when compressing images, batch converting formats, or resizing for web/social media.

Requirements

  • ImageMagick 7+ (magick) or ImageMagick 6 (convert)
  • Optional: cwebp (WebP), optipng (PNG), jpegoptim (JPEG)
  • No API keys needed

Instructions

  1. Check image info before processing:

    magick identify -format "%f | %wx%h | %b | %m\n" image.png
    
  2. Compress — reduce file size:

    # JPEG (80% quality is a good default)
    magick input.jpg -quality 80 -strip output.jpg
    
    # PNG (lossless optimization)
    optipng -o5 image.png          # in-place
    magick input.png -strip output.png
    
    # WebP (lossy, excellent compression)
    cwebp -q 80 input.png -o output.webp
    
  3. Resize — scale to specific dimensions:

    # Exact dimensions (may distort)
    magick input.jpg -resize 800x600! output.jpg
    
    # Fit within bounds (preserve aspect ratio)
    magick input.jpg -resize 800x600 output.jpg
    
    # By percentage
    magick input.jpg -resize 50% output.jpg
    
    # Thumbnail (crop to fill)
    magick input.jpg -resize 300x300^ -gravity center -extent 300x300 thumb.jpg
    
  4. Format conversion:

    magick input.png output.webp    # PNG → WebP
    magick input.jpg output.avif    # JPEG → AVIF
    
  5. Batch processing:

    # Convert all PNGs to WebP in a directory
    for f in *.png; do magick "$f" -quality 80 "${f%.png}.webp"; done
    
    # Resize all images to max 1200px width
    for f in *.jpg; do magick "$f" -resize "1200>" "$f"; done
    
  6. Output format — report results:

    ## ?️ Optimization Results
    | File | Original | Optimized | Savings |
    |------|----------|-----------|---------|
    | hero.jpg | 2.4 MB | 680 KB | 72% |
    | logo.png | 340 KB | 89 KB | 74% |
    **Total: 2.74 MB → 769 KB (72% reduction)**
    

Preset Sizes

Use Case Dimensions Notes
Web hero 1920×1080 JPEG q80 or WebP
Thumbnail 300×300 Crop to fill
Social (OG) 1200×630 Facebook/Twitter preview
Profile pic 400×400 Square crop
Email 600px wide Resize width only

Edge Cases

  • Animated GIF: Use magick input.gif -coalesce -resize 50% output.gif (preserve animation).
  • EXIF data: -strip removes metadata including GPS. Use -auto-orient -strip to preserve rotation.
  • Transparency: Converting PNG (with alpha) to JPEG loses transparency. Add -background white -flatten.
  • Very large files: Process in batches to avoid memory issues.
  • Already optimized: Check if compression actually reduces size — skip if negligible.

Security

  • Sanitize filenames before processing — avoid shell injection via crafted filenames.
  • Use magick not convert to avoid path conflicts with Windows convert.exe.

04 同仓库更多 Skills

kbarbel640-del
kbarbel640-del/skills

crowd-prompting

A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.

★ 1
kbarbel640-del
kbarbel640-del/skills

dilemm-ai

Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).

★ 1
kbarbel640-del
kbarbel640-del/skills

arxiv-paper-reviews

Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.

★ 1
kbarbel640-del
kbarbel640-del/skills

arxiv-paper-reviews

Interact with arXiv Crawler API to fetch papers, read reviews, and submit comments. Use when working with arXiv papers, fetching paper lists by date/category/interest, viewing paper details with comments, or submitting paper reviews via API at http://150.158.152.82:8000.

★ 1
kbarbel640-del
kbarbel640-del/skills

git-summary

Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.

★ 1
kbarbel640-del
kbarbel640-del/skills

agent-constitution

Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.

★ 1