Jacob Collins Jacob is a Java developer and the product manager of JPedal

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.



Are you a Java Developer working with Image files?

Why do developers choose JDeli over free alternatives?

  1. Works with newer image formats such as AVIF, HEIC, JPEG XL, WEBP
  2. Better support than alternatives for JPEG, PNG, TIFF.
  3. Prevent JVM crashes caused by native code in other image libraries
  4. Better performance than other popular Java image libraries
Jacob Collins Jacob is a Java developer and the product manager of JPedal