Blog · Guides

A sane PNG workflow: oxipng, zopfli and palettes

PNG is far from obsolete — used right, it's the best format for flat graphics. Here's how to get the smallest files without banding or dithering artifacts.

palette → oxipng → zopfli

PNG gets a bad rap for being "big," but most bloated PNGs are just badly encoded. With a clear three-step workflow — quantize, optimize, recompress — you can routinely cut a PNG by half or more, lossless, while keeping crisp edges and clean color. Here's the order that matters.

When PNG is the right tool

PNG is built for flat, sharp-edged graphics: logos, icons, UI exports, diagrams, screenshots and anything with transparency. It's lossless, so edges stay razor-clean — no JPEG mosquito noise around text. For photographs it's the wrong choice (use WebP/AVIF/JPEG), but for the synthetic graphics that fill modern apps, nothing beats a well-made PNG.

Step 1: quantize to a palette when you can

Most UI graphics use far fewer than 16 million colors. Converting a 24-bit truecolor PNG to an 8-bit indexed palette (≤256 colors) is the single biggest lever — it often halves the file before any other optimization. The catch is choosing colors well and handling gradients carefully; a good quantizer picks an optimal palette and only dithers where it actually helps.

Step 2: optimize filters with oxipng

PNG applies a per-row filter before compression, and the choice dramatically affects size. oxipng trials filter strategies and recompresses the image, fast and in parallel, with zero quality loss. It's the safe, everyday default: point it at a folder and it just makes every PNG smaller. Run it on both truecolor and palette images.

Step 3: squeeze DEFLATE with zopfli

When you want the absolute minimum and don't mind waiting, zopfli is a DEFLATE-compatible compressor that searches much harder for a smaller stream. It's slow — sometimes seconds per image — but it produces standard PNGs every decoder reads, often a few percent smaller than oxipng alone. Perfect for assets you ship once and serve millions of times.

# The full pipeline, lossless end to end
imageforge ui.png --palette auto --lossless        # step 1
imageforge ./icons/*.png --optimize oxipng         # step 2
imageforge logo.png --optimize zopfli --effort max # step 3

Avoiding banding and dithering artifacts

The two failure modes of palette PNGs are banding (visible steps in a gradient when there aren't enough colors) and dithering noise (speckle from scattering colors to fake more). The fix is judgment: keep gradients in truecolor, quantize the flat regions, and only dither at low palette sizes where the eye prefers noise to bands. When in doubt, compare the quantized version against the original before you ship it.

Step
Tool
Loss
Quantize
Palette / pngquant-style
Optional, controlled
Optimize filters
oxipng
None
Recompress
zopfli
None

Cut your PNGs in half, the right way.

Palette, oxipng and zopfli in one pass — lossless by default, on your Mac.

Join the waitlist
Keep reading