November 22, 2017

Even better PNG minification

We introduced a PNG minifier inside Photopea half a year ago. Today, we are glad to announce, that it is even better!

The previous minifier was fast and generated really small files, while keeping a decent quality. But it had problems in some cases, e.g. when there were large gradients.

We improved our PNG minifier by implementing a completely different quantization algorithm, based on k-D trees. It generates much better palettes and it is also 6x faster than the previous algorithm.

In the following example, we wanted to make an original PNG (18 kB - the first image) four times smaller. You can see an output of an old minifier, and an output of a new minifier, which looks significantly better.

Original - 18.7 kB Old minifier - 4.8 kB New minifier - 4.8 kB

Our new minifier is already available in Photopea. It is also available in our open-source library UPNG.js and at upng.Photopea.com.