Most Effective Method to Reduce and Optimize PNG Images

Written by Kevin Liew on 10 Mar 2010
281,070 Views • Techniques

Introduction

Just recently, I was assigned to in charge of an iPhone game website. Due to the design, it needs heaps of png files so that I can use CSS to layer them together. It's quite a sophisticated website when it also come with a jQuery scrolling effect. I hope I can show it here, but it haven't released yet. :)

I like png, it supports by all the browsers (except IE6, but you have the hack anyway). Usually, I would use JPEG or GIF, but this time, most of the images has drop shadow and the background of the website is tiled with clouds. However, we're facing a problem, the file size of the PNG files are pretty massive. Though most of us has fast Internet, but it's good to optimized all the images to be as small as possible without losing quality.

One of my friend showed us this technique to reduce PNG file size and I was pretty amazed. All the time, the PNG optimizer is here with me. That's it, we're using Adobe Photoshop to do it. Of course, not the Save as web, just one more step, we can reduce PNG file size but still maintain its image quality.

So, Obviously, you need photoshop, not sure if Gimp have it.

Step 1: A PNG File

I choose an image randomly and this is it:

Optimize PNG - Choose a PNG file

Step 2: Posterize it

Go to the menu bar, Image -> Adjustment -> Posterize

Optimize PNG - Posterize option

Step 3: Posterize it

After you've clicked on Posterize, you should able to see a dialog . It has a slider for posterize level adjustment. Slowly adjust it to your desired quality. If you observed it carefully, you will able to see some colors are being discarded, and that's the way to reduce the file size.

Optimize PNG - Adjust posterize level

Step 4: Save as web

Okay, the final step - save your file. Go to File -> Save as web... Then, you've just optimized your PNG file! I believe your PNG file size is reduced.

Optimize PNG - Save as web

A small test

The following is some tests I have done to see how much file size it has reduced.

  • Optimize PNG - Save as web

    Original file - 147 KB

  • Optimize PNG - Save as web

    Web Optimized (Save as web without posterization) - 70 KB

  • Optimize PNG - Save as web

    Posterized and save as web - 53 KB

  • Optimize PNG - Save as web

    Posterized with slight losing of Image quality and save as web - 37 KB

Conclusion

There are a lot of softwares out there, but most of them couldn't do the job well. I still reckon we need human eyes to make sure we optimize the images properly without compromising too much of the image quality. This is a simple technique and I guess it's the most efficient and less time consuming. However, we do need Adobe photoshop or si image editor that has posterize or similar capabilities.

If you think, it's not worth it to run a big program just to do a small task, well, it works for me because I have photoshop running all the times. :) I hope it helps. Cheers.

If you have a better way to do it, don't forget to share it in the comment below :)

Join the discussion

Comments will be moderated and rel="nofollow" will be added to all links. You can wrap your coding with [code][/code] to make use of built-in syntax highlighter.

71 comments
Jn 12 years ago
Thanks Man...Awesome..you rock!!!
Reply
Paul 12 years ago
Xlent idea - Thanks for sharing!! Works a treat I'm saving 50% on all my .pngs
Reply
Ian 12 years ago
Thanks for explaining some of the details. I figured this out a week ago but had to do some research to know what posterise is and why it works for reducing image size (removes unused colors). Good post
Reply
Victor 12 years ago
Wow, this is great. I would also add that you can run it through a png compression program such as PNGSquash (available on the app store) or Yahoo SmooshIt (available as an extension to firebug) or all 3 methods to get your pngs even smaller.

I'm going to experiment with this method and the above compressor applications to see how small I can get some big pngs I've got for a web design I'm currently working on.

Thanks so much!
Reply
Abhishek 12 years ago
Great information. Thanks. I have one more way to greatly reduce the file size. First do as usual in photoshop and save file as web. Now use a free software PngOptimizer. Drag file in that software. And you will be able to reduce PNG size by more 50%. My (Original (600 kb) > After Photoshop (275 Kb) > After Pngoptimizer (140 KB). You can also run image in PunyPNG for 5-6 % more reduction in file size.
Reply
prakash.m 12 years ago
Thank you Guy.It is very nice and valuable tips..thank you..:)
Reply
AG 12 years ago
Wow...totally worked. Helps especially when needing to downsample web banners. Just took 200k off my file. So simple, but sometimes you just need someone to show you. THANKS!!!
Reply
inchic 12 years ago
whoa! thank you so much! you really help me a lot!
thanks for sharing.. really big help!
awesome!
Reply
Rolf Timmermans 12 years ago
There's also http://tinypng.org which does a better job at reducing the number of colours in PNG images and performs additional optimisations.
Reply
neosheet 12 years ago
Indeed! IMHO the best lossy compression for PNG so far
Reply
Arian Pradana 12 years ago
Awesome ! Big thanks !
i searching for this method has long :D
Reply
Sanjay Kumar 12 years ago
Thanks for the Solution :-)
Reply
Andreas Ollmann 12 years ago
If you build large websites with a lot of PNG with alpha channels, you might want to try this solution, which does the job automatically, using jQuery, canvas element and JS, saving up to 80% hazzle-free: http://headers-already-sent.com/artikel/shrinkimage-1
Reply
Aloysio Chagas 12 years ago
Really nice! Thank you!
Reply