pngquant
$ pngquant Community Low Riskpngquant converts 24/32-bit RGBA PNGs into tiny 8-bit indexed-color PNGs while retaining smooth alpha transparency. It supports quality bounds (--quality=min-max), --skip-if-larger, stdin/stdout (-), and refuses to overwrite existing files unless --force is given.
brew install pngquant Palette quantization of PNG sprites and screenshots is a fast local binary step with no MCP utility.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic non-interactive CLI with stdin/stdout (-), --output, and semantic exit codes (98, 99), though lacks JSON output and --dry-run.
- Non-interactive; supports
--quality,--skip-if-larger, and-stdio - No JSON output or
--dry-run
Refuses to overwrite existing files by default (writes *-fs8.png unless --force is passed) and respects --skip-if-larger.
- Defaults to non-destructive
-fs8.pngsuffix and rejects overwrites without--force
Tiny standalone C binary packaged on Homebrew, Linux distros, and Windows.
- Available via
brew install pngquantand OS package managers
Regularly achieves 60–80% PNG size reduction with minimal perceptual loss; pairs well before oxipng.
- High-quality median-cut quantization preserving full alpha channel
Mature project by Kornel Lesinski (kornelski/pngquant) backed by libimagequant.
- Official
kornelski/pngquantGitHub repository
Clear --help and man page explaining exit codes 98/99 and --speed presets.
- Manual at pngquant.org and built-in
--help
Security, Auth & Guardrails
None required; operates on local PNG files or stdin/stdout.
GPL-3.0-or-later open source; commercial license available for proprietary embedding.
# pngquant Agent Rules - Expect exit code `98` (`--skip-if-larger` aborted) or `99` (below `--quality` minimum) as valid non-fatal outcomes rather than tool crashes. - Specify `--output <path>` instead of `--force --ext .png` so original lossless PNGs are preserved.
Agent-Ready Command Recipes
Safe Read-Only Queries
pngquant --help
Prints CLI options, quality exit codes (98/99), and default suffix behavior without modifying files.
Controlled Writes & Previews
pngquant --quality=65-80 --skip-if-larger --output out.png input.png
Writes out.png only if quality reaches 65+ and file size shrinks, leaving input.png untouched.
Strengths for Agents
- + Safe-by-default naming (
-fs8.png) prevents accidental overwrites unless--forceis explicitly set. - +
--skip-if-largerand--quality=min-maxenforce automated quality/size guardrails.
Caveats & Pitfalls
- ! Exit codes
98(larger output skipped) and99(quality threshold unmet) trigger errors in naiveset -eagent scripts. - ! Lossy quantization reduces colors to 256 per image; run
oxipngwhen strict lossless output is required.