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
- 参考文档_meta.json280 B
- 参考文档README.md311 B
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
-
Check image info before processing:
magick identify -format "%f | %wx%h | %b | %m\n" image.png -
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 -
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 -
Format conversion:
magick input.png output.webp # PNG → WebP magick input.jpg output.avif # JPEG → AVIF -
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 -
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 |
| 600px wide | Resize width only |
Edge Cases
- Animated GIF: Use
magick input.gif -coalesce -resize 50% output.gif(preserve animation). - EXIF data:
-stripremoves metadata including GPS. Use-auto-orient -stripto 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
magicknotconvertto avoid path conflicts with Windowsconvert.exe.
04 同仓库更多 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.
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).
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.
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.
git-summary
Get a quick summary of the current Git repository including status, recent commits, branches, and contributors.
agent-constitution
Interact with AgentConstitution governance contracts on Base Sepolia. Check compliance, read rules, log actions, query governance state.