Image optimization

SkillMedia

Compresses PNG, JPEG, and GIF images before they are committed (pngquant + oxipng pipeline, jpegoptim/mozjpeg, vips, gifsicle). Use when adding or updating any image in the repo, such as wordpress.org screenshots, banners, teaser images, or OG share cards.

Available today. Use it from your connected AI after setup.

Add ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.

Then ask your AI: use the Image optimization skill

What this skill tells your AI

The instructions your AI receives, as published by bonny/wordpress-simple-history in .claude/skills/image-optimization/SKILL.md and read by ahel’s review.

Every PNG committed to the repo — wordpress.org screenshots and banners, teaser images, OG share cards, avatars, icons — goes through compression before it lands. These files ship to users and are served from wordpress.org's CDN, so bytes matter.

Two-step pipeline, always in this order:

# 1. Lossy quantization to an 8-bit palette (usually 60-70% of the win).
pngquant --quality=80-95 --strip --skip-if-larger --force --ext .png <file>.png

# 2. Lossless recompression on top.
oxipng -o max --strip safe <file>.png

--skip-if-larger means step 1 is a no-op when quantization would not help, so the pair is safe to run on anything. Both steps are idempotent — re-running on an already-optimized file changes nothing.

For a whole directory:

pngquant --quality=80-95 --strip --skip-if-larger --force --ext .png *.png
oxipng -o max --strip safe *.png

Check the result and mention the saving when reporting back:

ls -lh *.png

If a screenshot has fine gradients or text that visibly degrades at 80-95, raise the floor (--quality=90-100) rather than dropping step 1 entirely. Do not commit a PNG straight out of Playwright or an image editor.

Other Formats

  • JPEG — jpegoptim --strip-all -m85 <file>.jpg, or /opt/homebrew/opt/mozjpeg/bin/cjpeg -quality 82 -optimize -progressive when encoding from source (mozjpeg is keg-only, so it is not on PATH).
  • Resizing / format conversion — vipsthumbnail in.png --size 1200x -o out.png. vips is the fast batch workhorse and uses mozjpeg for JPEG output automatically.
  • GIF — gifsicle -O3 --lossy=80 in.gif -o out.gif.
  • WebP / AVIF — cwebp -q 80 and avifenc are available, but wordpress.org assets must stay PNG/JPEG.

See CLAUDE.local.md for which of these are installed locally.

Signals

GitHub stars
317
Forks
74
Last commit
Sep 2026
Advanced
Item type
skill
Key
image-optimization-bonny
Source
github.com/bonny/wordpress-simple-history