Optimizing PNGs with OxiPNG and pngquant
Learn how palette reduction, filters, and deflate optimization compress heavy PNG images.
MV
Marcus Vance
Contributing Author · Squoosh Next BlogPNG files are notorious for large sizes because the lossless deflate compression engine cannot exploit the psychovisual redundancy that lossy codecs leverage. OxiPNG, written in Rust, optimizes PNG files by systematically testing all combinations of row filters (none, sub, up, average, Paeth) and zlib compression levels (1–9) to find the minimal valid PNG bitstream without changing a single pixel. For even greater savings, pngquant performs 8-bit palette reduction using a modified median-cut algorithm, mapping millions of colors to a 256-color index.
Combining pngquant palette reduction followed by OxiPNG deflate optimization can yield 65–72% size reduction over unoptimized PNG while retaining transparency and pixel-sharp edges.
Key Takeaways
PNG files are notorious for large sizes because the lossless deflate compression engine cannot exploit the psychovisual redundancy that lossy codecs leverage.
OxiPNG, written in Rust, optimizes PNG files by systematically testing all combinations of row filters (none, sub, up, average, Paeth) and zlib compression levels (1–9) to find the minimal valid PNG bitstream without changing a single pixel.
For even greater savings, pngquant performs 8-bit palette reduction using a modified median-cut algorithm, mapping millions of colors to a 256-color index.
Combining pngquant palette reduction followed by OxiPNG deflate optimization can yield 65–72% size reduction over unoptimized PNG while retaining transparency and pixel-sharp edges.
Try It in the Workspace
Everything discussed in this article can be tested directly in Squoosh Next — no sign-up, no upload, 100% client-side.