Guetzli, is a recently Open Sourced JPEG encoder from google. I gave it a whirl to test out the performance/timing for image compression. I’ve tried out PNG->JPG, and JPG only compression with the default quality.
Installation on Ubuntu:
Follow the instruction given on Github Repo:
- Clone/Download the source code from Github Repo .
- Install libpng and gflags, using
apt-get install libpng-dev libgflags-dev.
- Run make and expect the binary to be created in bin/Release/guetzli
- The binary gets created in same directory inside bin/Release/
- Run
vim ~/.bashrc
and go to the end of file, addexport PATH=~/guetzli/bin/Release:$PATH
and save it, where guetzli is your root folder name.
Performance:
I’ve tested out 5 of each PNG and JPEGs for the conversion on a Digital Ocean single core Ubuntu droplet with 500MB RAM.
PNG Optimisation:
Image Link Original Size Optimised Size Time
bees.png 177KB 37KB 0 m 16.372 s
( Orig | Optimised )
Old_Jewish_man.png* 49KB 195KB 16 m 5.397 s
( Orig | Optimised )
Render_Homer_8.png 218KB 146KB 0 m 59.611 s
( Orig | Optimised )
Winter-Is-Coming.png 1.3 MB 286KB 2 m 26.712 s
( Orig | Optimised )
Himalayas.png 546KB 265KB 4 m 52.428 s
( Orig | Optimised )
JPEG optimisation:
Image Link Original Size Optimised Size Time
100_5478.jpg 189KB 168KB 2 m 14.152 s
( Orig | Optimised )
Eiffel_Tower_Black_White.jpg 250KB 132KB 0 m 45.584 s
( Orig | Optimised )
taj-mahal-H.jpeg 473KB 153KB 2 m 44.823 s
( Orig | Optimised )
Leopard Wallpaper.jpg 699KB 596KB 11 m 35.742 s
( Orig | Optimised )
Kangaroo.jpg 270KB 237KB 3 m 42.517 s
( Orig | Optimised )
* For transparent PNGs, Guetzli automatically inserts a black background while converting them to JPGs, and the image size went 4x higher from 49KB to 195KB and it took 16 minutes for the conversion.
PNG to JPG optimisation is pretty damn good for images without alpha channel aka transparency. Though the time taken for a 177KB file size is 16s, which is way too slow considering if your site have got as low as 500 images, and out of which most of them would be at least above 500KB.
Same goes for JPG to JPG optimisation, a few images are reduced to half, where others got a savings of up to 100KBs. Though the time spent on optimisation is still very high for all of them.
Images for comparison:
PNG to JPG
JPG to JPG
Guetzli is quite time/resource consuming to be implemented in production. I was not able to optimise a 4MB image, as the process was killed every time.
Online converter is available:
http://guetzliconverter.linuxadm.hu/
I presume large part of the slowness and memory use is because it’s the first release and Guetzli hasn’t been optimized yet.
Maybe, but we’re talking about a lot of optimization. Until it gets optimized, it’s not very usable.