How do you compress PNG images? PNG file format images are a favorite in photography and on websites. The file type is also an excellent choice for logos and creative images because of their ability to contain transparency. Because of the high-quality seen in PNG’s, they can be quite large. Compressing your files is a way to reduce file size and make your website load faster, but how do you compress PNG images?
PNG compression is a process to reduce PNG file size by optimizing how your computer reads the file data. You can also compress a PNG file by lowering the image quality. Unlike JPEG files that get terrible picture artifacts with heavy compression, PNG’s use lossless compression, meaning compression doesn’t impact image quality.
There’s initial compression done in the export stage, but you can use further methods to reduce the PNG file size more.
When exporting a PNG file, compression is done in two steps, with the first being pre-compression (filtering) and second, being the actual compression (DEFLATE).
All files on your computer, including PNG files, are made up of 0's and 1's. Bits and bytes. The first stage, filtering, analyze and re-arranges the data, so it's more accessible to the compression algorithm which comes next.
The second stage, DEFLATE, is where the compression goes into action. DEFLATE checks for repetitive, re-occurring data and group, tag, and delete it.
The process can be explained simply by imagining five blocks, each block representing 1 bit of data in your image:
"    "
Instead of having four identical bits of the information "1", compression works by grouping re-occurring data together, telling your computer that the file contains four "1"’s and one "0."
The compressed sequence is then "[1x4] ", taking up only 2 blocks, (or bits), on your hard drive – a 60% compression and reduction in file size.
How much you can compress a PNG image can ultimately depend on whether you’re using lossless compression or lossy compression.
Changing your color depth from 24-bit (16 million colors) to 8-bit (256 colors) can reduce the file size by 50% or more. But this comes at a loss of image quality, which is why this is called lossy compression. Sometimes the difference is noticeable, other times not.
With lossless compression when exporting your image, the file size reduction typically isn’t that great. In size, you’re typically looking at a 0-10% reduction. It’s better than nothing, but if you’re looking to heavily compress your PNG images, lossy compression or using WinZip are better ways to go.
There are two main reasons as to why someone would want to compress PNG images.
PNG files are high quality and often take up a lot of space on your hard drive. By reducing file size with compression, you can store more images and other files. Coincidentally, file size also impacts loading times on websites. If your website contains many PNG images and you were to reduce their file sizes by only 20%, it adds up, resulting in faster loading times after compression.
In image editing software, you can often set the amount of lossless compression when saving in PNG. This compression does not impact image quality like with JPEG; it merely optimizes how you store the file on your hard drive.
But exporting your PNG file using more compression takes a longer time. This delay is usually not a problem unless you have a slow computer or compress thousands of PNG files simultaneously.
The best option to compress your PNG files without affecting image quality is using a program such as WinZip. This compression doesn’t just save you a lot of space; you also get a more convenient way of storing them in archives, like compressed folders.
You can also do lossy PNG compression by reducing the color depth and other factors. Depending on how much you compress, the results can be quite noticeable.