Losslessly optimising images


In today’s installment of things you already know unless you don’t, there are a few tools you can use to losslessly optimise and reduce file sizes of various image formats. Yes, even lossy formats have some slack.

Glenn Randers-Pehrson’s pngcrush:

$ pngcrush -reduce -verbose $IN.png $OUT.png

Timo Kokkonen’s jpegoptim:

$ jpegoptim --all-normal --verbose $IN.jpg $OUT.jpg

Eddie Kohler’s gifsicle:

$ gifsicle -O3 --verbose -i $IN.gif -o $OUT.gif

Jeff Schiller and Louis Simard’s scour:

$ scour -i $IN.svg -o $OUT.svg

I have a glorified shell script that invokes the right optimiser depending on an input file’s extension. Every file that ends up here goes through one of these.

It’s funny to think about video sites serving terabytes of content a second, and here I am shaving a few kilobytes here and there from your downloads on my silly little blog. But every bit (hah!) helps.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

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

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.