pngcrush with reduce

Software

Every PNG image on Rubenerd, and every screenshot in documentation I write, gets run through pngcrush. It losslessly removes data and optimises the resulting image, often by a shocking amount. Today I learned there’s another flag you can use:

-reduce (do lossless color-type or bit-depth reduction)

This inks out even more space, especially on images that have a very limited palette. The caveat here is you’d potentially want to save it back as a full depth image before editing, or operations like resizes will look jagged and gross.

So now my standard is reduce the size, don’t update the file timestamp, overwrite the original, and work with broken images if possible:

$ pngcrush -reduce -oldtimestamp -ow -fix

I haven’t run into problems using -ow, but you may want to eschew (gesundheit) that option and save a second image if you want to be cautious. You can use -brute, but it takes sufficiently longer without any discernible benefit for me to bother.

It’s available from Homebrew, MacPorts, FreeBSD ports, and pkgsrc.

Author bio and support

Me!

Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

You can leave me a comment by contacting me, and I might publish your thoughts. Please read the FAQs first though.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!