Comparing PNG Compression Algorithms

49 sec read

In this article we will be comparing the different compression methods available to use within PNG images. To do this, we will be using our Java image library, JDeli. We will be comparing against file size, quality of output, and speed.

For the baseline of our comparisons, we will be using the following image. It has a file size of 39.3MB and takes just under 5 seconds to encode.

DEFLATE

DEFLATE was designed in the 1990s and is most commonly using in ZIP file archives due to its lossless property.

Using DEFLATE, the file size is reduced to 5.1MB taking around 6 seconds to encode. Since DEFLATE is lossless, the image quality is preserved and matches the original file.

QUANTISE

QUANTISE is a lossy compression technique that reduces file size by limiting the range of available colours. It is commonly used in PNG and GIF images.

Using QUANTISE, the file size is reduced to 3.5MB. QUANTISE is lossy so there is a reduction in image quality, most noticeably in the range of colours which are outputted. It also takes around 6 seconds to encode.

Conclusion

In conclusion, there are not a great deal of options when it comes to different compression algorithms in PNG files. DEFLATE is a clear winner here as it reduces the file size with no loss of quality. QUANTISE would only be better when the smallest possible file size is necessary.



Why do developers choose JDeli over free alternatives?

  1. Works with newer image formats such as AVIF, HEIC, JPEG XL, WEBP (AVIF next release) that are not supported in Java.
  2. Better support than alternatives for JPEG, PNG, TIFF.
  3. Process images up to 3x faster than ImageIO and other Java image libraries.
  4. Prevent JVM crashes caused by native code in other image libraries such as ImageIO.
  5. Image security as JDeli processes images on your servers with no calls to any external system or third party library.

Are you a Java Developer working with Image files?

What is JPEG XL?

Nadir
55 sec read

What is JBIG2?

JBIG2 is a lossless and lossy compression standard for bi-level images like scanned documents, offering high compression ratios by identifying and encoding similar shapes...
chika
47 sec read