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.
In this repository28 other files it gives its agents.
- ai-graphicsSkill
- auto-deskewSkill
- auto-toneSkill
- auto-white-balanceSkill
- batch-set-copyrightSkill
- check-model-pricingSkill
- convert-to-avifSkill
- fast-resizeSkill
- fast-thumbnailSkill
- from-jxlSkill
- images-to-pdfSkill
- install-depsSkill
- new-projectSkill
- new-workflowSkill
- open-workspaceSkill
- optimize-jpegSkill
- pdf-extract-embedded-imagesSkill
- pdf-to-imagesSkill
- read-metadataSkill
- scrub-metadataSkill
- set-metadataSkill
- svg-to-rasterSkill
- to-jxlSkill
- transcode-jpeg-to-jxl-losslessSkill
- upscale-imageSkill
- vectorizeSkill
- web-readySkill
- workspace-setupSkill
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
- Distinctive: line 19
Do not use this skill when:
- Very specific: line 36
Verify the relevant binary exists.
≈ “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.
Files
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-readyorchestrator.
Do not use this skill when:
- Source is JPEG → use
optimize-jpeg. - Source is RAW/HEIC/TIFF → run
web-readyend-to-end first. - Quality must be bit-perfect for cryptographic hashing → only use
losslessmode.
Inputs
- Input — file or directory. Required.
- Mode —
lossless(default) orlossy. - Recursive —
--recursivefor directory descent. - In-place — default.
--output-dir <path>to write copies. - Lossless level (mode=lossless) —
oxipng -o <0..6>. Default4.6is ~20% slower for ~1–2% extra compression. - Lossy quality (mode=lossy) —
pngquant --quality min-max. Default65-80(web-good). Increase floor for sensitive material. - Strip metadata — default off.
--stripremoves EXIF/iTXt/zTXt/tIME chunks (oxipng--strip safe). Use when web-prep doesn't need camera info.
Procedure
- Verify the relevant binary exists.
which oxipngfor lossless;which pngquantfor lossy. If missing, point atinstall-deps. - Enumerate inputs (PNG only — skip non-PNG with a one-line note).
Lossless (oxipng):
oxipng -o <level> [--strip safe] [--out <out-dir>] "<input>"In-place is the default; pass
--outonly if--output-dirwas set.oxipngis multithreaded by default — no need to xargs-parallelise.Lossy (pngquant):
pngquant --quality <min>-<max> --skip-if-larger --strip --output "<output>" "<input>"--skip-if-largeris critical — pngquant occasionally produces a larger file on already-quantised inputs; this prevents inflation.--stripremoves optional chunks (default off in pngquant — explicitly enable for web-prep).- 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
oxipnglossless on a typical screenshot: 20–40% reduction. On already-optimised PNGs (e.g. via Photoshop "Save for Web"): often 1–5%.pngquantis 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.
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
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.

