Search code examples
pngpagespeedimage-compression

PNG optimization - can a PNG be further optimized


I created a design for my website in Photoshop and exported all images as 24-bit PNG images. Later, running a PageSpeed test on the website showed that the images can be further reduced upto 50% in size with lossless compression. How can this be? Does Photoshop not compress the images as much as possible? What image compression program does Google PageSpeed uses internally, I might want to give it a try.


Solution

  • Actually, compressing PNGs is more complex than, e.g., plain text compressing. There are dozens of different factors, that determine the final size of the image.

    For example, you say, that you use 24bit PNGs. If your image only has 256 colors, you might be better off with an 8bit PNG (converting to indexed colors before saving).

    Then, PNGs can contain metadata (like who and which program created them). That can be stripped. And so forth.

    Take a look at the manual of optipng to get a basic idea on which wheels to turn, if you want to really minimize the PNG filesize.

    My guess is, that the actual binary, that Google Pagespeed uses, is irrelevant. It will rather check some properties of the PNG to decide, if the PNG could be minified more (OptiPNG is even linked there).

    Edit: The other day I found an interesting topic on the various PNG types: http://calendar.perfplanet.com/2010/png-that-works/