Prismjs

Compressing jpg images with Guetzli

Guetzli is a JPEG encoder that aims for excellent compression density at high visual quality. Guetzli generates only sequential (nonprogressive) images of the same quality generated by libjpeg. ) JPEGs due to faster decompression speeds they offer. Guetzli is a JPEG encoder that achieves excellent compression ratios with high quality, Guetzli typically generates jpegs that are 20-30% smaller than those generated by libjpeg.

So Guetzli is in fact an image encoding that is fully compatible with jpg decoding while having a high quality and high compression ratio.

Compile

Installing dependencies

On Debian/Ubuntu

``zsh apt-get install libpng-dev

On CentOS/RH

``zsh
yum install libpng-devel

On Fedora

``zsh dnf install libpng-devel

On ArchLinux

``zsh
pacman -S libpng

On Alpine Linux

``zsh apk add libpng-dev


###### compiled from source

``zsh
git clone https://github.com/google/guetzli.git
cd guetzli/
make

The compiled binary file is located at bin/Release/guetzli.

Use

The compiled binary file is ready to use.
Guetzli supports both jpg and png image encoding and compression.

zsh guetzli [--quality Q] [--verbose] original.png output.jpg guetzli [--quality Q] [--verbose] original.jpg output.jpg The –quality` parameter is the quality, the value of 100~85, the default is 95.
Compress a size of 1200x900 file size of 337kb image for example, the default compressed image size 254k.

  • Before Compression
  • :: Compressed

Compare with other pictures

image type image size compatibility notes
The best of the best.      
This is a very long encoding and takes a lot of memory. It takes a lot of time and memory to encode.      
png large best png
Only Chrome and Android are supported natively. Non-native platforms require specific programs to do the coding and decoding, which consumes extra time.      

For certain applications, it is useful to compress jpg images with Guetzli in a single pass.

Update

ChromeLabs has open sourced a new tool that integrates several of the more well-known tools.
One of them is MozJPEG for more efficient re-encoding of jpg.
https://github.com/GoogleChromeLabs/squoosh/