agentleFS
danielrosehilldanielrosehill/Claude-Image-Production-Plugin/skills/optimize-png/SKILL.md

optimize-png

Skill21 starsChanged 7 days agoMITView on GitHub

Use when the user wants to shrink PNG files in a batch — losslessly with `oxipng` (typical 20–40% reduction, byte-identical decode) or aggressively with `pngquant` (lossy palette quantisation, 60–80% reduction with near-imperceptible quality loss for web use). Web-prep workhorse.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not use this skill when:

    line 19
  2. Very specific:

    Verify the relevant binary exists.

    line 36

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Optimize PNG

Squeeze PNG file size. Two modes:

  • lossless (default) — oxipng. Byte-identical decode. Always safe.
  • lossy — pngquant. Palette-quantised; visible artefacts only on smooth gradients. Right call for web/UI assets.

When to use

  • Web-prep: PNG screenshots, UI assets, illustrations destined for upload.
  • Archival: shave a few hundred MB off a folder of PNG masters losslessly.
  • Pre-step inside web-ready orchestrator.

Do not use this skill when:

  • Source is JPEG → use optimize-jpeg.
  • Source is RAW/HEIC/TIFF → run web-ready end-to-end first.
  • Quality must be bit-perfect for cryptographic hashing → only use lossless mode.

Inputs

  1. Input — file or directory. Required.
  2. Mode — lossless (default) or lossy.
  3. Recursive — --recursive for directory descent.
  4. In-place — default. --output-dir <path> to write copies.
  5. Lossless level (mode=lossless) — oxipng -o <0..6>. Default 4. 6 is ~20% slower for ~1–2% extra compression.
  6. Lossy quality (mode=lossy) — pngquant --quality min-max. Default 65-80 (web-good). Increase floor for sensitive material.
  7. Strip metadata — default off. --strip removes EXIF/iTXt/zTXt/tIME chunks (oxipng --strip safe). Use when web-prep doesn't need camera info.

Procedure

  1. Verify the relevant binary exists. which oxipng for lossless; which pngquant for lossy. If missing, point at install-deps.
  2. Enumerate inputs (PNG only — skip non-PNG with a one-line note).
  3. Lossless (oxipng):

    oxipng -o <level> [--strip safe] [--out <out-dir>] "<input>"

    In-place is the default; pass --out only if --output-dir was set. oxipng is multithreaded by default — no need to xargs-parallelise.

  4. Lossy (pngquant):

    pngquant --quality <min>-<max> --skip-if-larger --strip --output "<output>" "<input>"

    --skip-if-larger is critical — pngquant occasionally produces a larger file on already-quantised inputs; this prevents inflation. --strip removes optional chunks (default off in pngquant — explicitly enable for web-prep).

  5. Track total before/after sizes; report the savings.

Output

  • Optimised PNG files at the resolved paths.
  • Summary table:
    • Files processed / skipped / failed.
    • Total: <orig-MB> → <new-MB> (<pct>% saved).
    • Worst compressors (files with <5% savings) — flag for inspection.

Notes

  • oxipng lossless on a typical screenshot: 20–40% reduction. On already-optimised PNGs (e.g. via Photoshop "Save for Web"): often 1–5%.
  • pngquant is irreversible. Keep originals if there's any chance the file will need further editing.
  • For animated PNGs (APNG): both tools handle them but check output visually first.
  • Combining lossy then lossless (pngquant → oxipng) gets a few extra % off — the orchestrator (web-ready) does this automatically; this skill keeps it as separate modes for explicit control.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.