molly.com

Tuesday 20 November 2007

Your Best Practices for Creating Great PNGs

I’ve been futzing with PNGs for years and still find myself thinking there has to be some better way to get the best compression and still retain the quality of the image. I notice that while I can create great PNGs in a variety of software such as Photoshop and Fireworks, I still can only manage to get acceptable results, I’ve seen others do a lot better.

So, I’m askin’ for your wisdom regarding best practices for creating great PNGs, especially now with alpha transparency support in IE7. What are your tools? Processes? Any special techniques you care to share?

Filed under:   standards, software, web design and development, creativity, ie7, molly asks you
Posted by:   Molly | 12:24 pm |

67 Responses to “Your Best Practices for Creating Great PNGs”

  1. Fyrd Says:

    Have you tried using PNGCrush?

  2. Fyrd Says:

    Actually, you’ll probably want the more user friendly PNGCrusher.

  3. thacker Says:

    Have used PNG formats exclusively for years, primarily PNG-8 .. PNG-24 only when quality is extremely critical.

    ImageReady within Photoshop. Be cognizant of dither. For alpha transparency trick with Fireworks … check this post:

    http://www.sitepoint.com/blogs/2007/09/18/png8-the-clear-winner/

    Fireworks is an excellent vector/raster hybrid for creating layout images/backgrounds, slicing them and exporting them in PNG format.

  4. jetboy Says:

    Just because you have 24 bit colour depth doesn’t mean you have to use it. The less colours, the smaller file size, similar to GIFs and 8 bit PNGs.

    If I just need alpha transparency, I export an 8 bit PNG with alpha from Fireworks (which isn’t compatible with IE’s alpha filter, although is supported by IE7), open it up in Fireworks again and export it as a 32 bit PNG. There’s only a small size overhead for the change in file format.

    In theory, for photographic images, dropping the colour depth down to 16 bit (for example) before exporting should save some space. If anyone knowns how to do this in Photoshop or Fireworks without a third party plugin, I’d love to know!

    For stripping out the gamma data and for final compression check out PNGCrush (as mentioned) and TweakPNG.

  5. Jules Says:

    I use Fireworks and create the image against a transparent background.

  6. Rob Says:

    Don’t use png for photos. Use jpeg. PNG replaces gif, not jpeg. jpeg does a better job with photos than png does.

  7. thacker Says:

    jpeg does a better job with photos than png does

    Sorry, Rob, but I take exception.

    PNG - 8 bit will render deep color photography as well as JPG (JPEG 2000 not included) in both depth of color and smooth continuous tones for use within Web applications. When the pseudo Internet speed utilities are used, which will further compress any optimized JPG thus causing quality degradation, PNG is the practical choice.

  8. feo Says:

    Here is some info about better ways of PNG compression:

    http://translate.google.com/translate?u=http%3A%2F%2Fwww.artlebedev.ru%2Ftools%2Ftechnogrette%2Fetc%2Fpng-1%2F&langpair=ru%7Cen&hl=en&ie=UTF-8

    Original is in Russian.

  9. Lee Carré Says:

    The GIMP” is pretty good for web related image creation and manipulation. I’m sure I don’t need to mention why open-source software is a Good Thing.

    For formats supporting colour-indexing, like PNG (and GIF), the default option used by The GIMP is to generate an optimal palette from the actual colours used in the image, which allows you to retain exact colours, while reducing your colour palette, thus reducing file-size.

    GIMP lets you choose exactly what data is saved in your PNG files.

    OptiPNG” is another good PNG compactor which doesn’t compromise quality while still reducing file-size.

  10. Ariel Burone Says:

    In this very moment I’m working on PNG’s whit alpha transparency.
    I need to optimize em to the last bit, so the process is a little long. But the final quality is excellent.
    1) Create the image in photoshop and save it as PNG24 with transparency
    2) Reduce the colors to 256 whith pngquant Front End (http://jedisthlm.com/index.php?p=29)
    The color reduction of pngquant y WAY better than photoshop one, pngquant gets much better transitions.

    since IE

  11. Ariel Burone Says:

    Mi comment got truncated…
    Ok I’ll be concise.
    3) convert to 24 bits whit Gimp
    4) optimize with pngcrush.exe -brute -reduce
    Some result at http://maquillajetiti.com.ar/productos.php?cat=18

    cheers,
    Ariel

  12. giz404 Says:

    On windows, PNG Optimizer does a great job. http://psydk.org/PngOptimizer.php

  13. Fraser Pearce Says:

    Another windows option is PNGGauntlet:

    http://brh.numbera.com/software/pnggauntlet/

  14. Jake Archibald Says:

    Here’s another vote for PNG Gauntlet. It’s worth running all PNGs through it, especially those make with applications that don’t let you ommit gamma data, such as Photoshop.

    I have to disagree with jetboy that 8bit PNGs are smaller than 24bit ones. It’s quite common to have a 1px high / wide image which, when tiled, creates a gradient. In this case, the space used up creating the colour table is greater than specifying the colour in full, so the 24bit PNG is smaller.

    Jake.

  15. Jonathan Porter Says:

    I use OptiPng. It allows for the highest possible compression using the standard compression libraries and it does automatic lossless color depth reduction if possible.

  16. thacker Says:

    Thanks for all of the various PNG compression/optimization utilities that have been referenced.

    Having tried a few of them, I am only seeing, on average, a 4% reduction in file size of PNGs that have been optimized within Photoshop CS3 (ImageReady or whatever Adobe is calling it these days).

  17. Jeff L Says:

    I’ve found SuperPNG plugin for Photoshop does a decent job of gamma correction when using PNGs.

    Using ImageReady “save for web” feature in Photoshop has NOT yeilded good results for me in the past, and I would not recommend it.

    Some of the other tools are good, but I don’t like having to take the extra step, if I’ve created the graphic in PS and I’m saving it from PS, I want it to save properly with correct gamma correction and compression.

  18. thacker Says:

    Jeff L–

    I am very much interested in learning what specific issues that you experience with producing PNG compressed files using the “Save for Web and Mobile Devices” function within Photoshop CS3. Is it with final compression size, image clarity, color depth, continuous tones, alpha channel, etc? And with what types of images? Thanks.

    And thanks for the SuperPNG plugin. That looks like it may resolve issues I have had when needing to add a MarcSpider digital watermark to optimized PNGs and then save them with optimization without degrading the embedded digital watermark.

  19. Blake Says:

    I use Photoshop, “save for web” and then run the images through GammaSlamma:

    http://www.shealanforshaw.com/introducing-gammaslamma-10-for-osx/

    which is an easy to use ported version of PNGCRUSH for OS X.

  20. Sonnenschutz Says:

    For formats supporting colour-indexing, like PNG (and GIF), the default option used by The GIMP is to generate an optimal palette from the actual colours used in the image, which allows you to retain exact colours, while reducing your colour palette, thus reducing file-size.

  21. Firmalar Says:

    I use Fireworks and create the image against a transparent background.

  22. Jeff L Says:

    thacker,

    Can’t really answer your question as I’ve got PS6 at home and PS7 at work.

    Not everyone gets the fancy new versions to play with right away… :-(

    However, the biggest issue with these versions that I’ve run into is the gamma correction - meaning colors come out differently depending which browser you use to view them.

    Here’s an article I’ve had bookmarked for a while about the issue:
    http://hsivonen.iki.fi/png-gamma/

  23. thacker Says:

    Jeff L–

    Thank you very much.

    I have run into the same gamma issues with prior versions of Photoshop. For Web production, I assign the Adobe RGB color profile, initially, to any image. From there, I do whatever corrections or adjustments that may be necessary.

    One issue that was prevalent in older versions was that assigned hex color values were not consistent with other formats or even with PNGs created with other applications, e.g. Fireworks.

    A simple fix that I have used and just pulled [I can’t recall the original source] from http://www.polarbearlamps.net/2007/04/png_color_mismatch_on_the_web.html
    required modification to the meta data within the PNG image after is has been optimized.

    The solution/fix as quoted from Polar Bear Lamps:

    After you’ve saved your file in png format (preferably through the save for web feature), close it and reopen it (so to make sure it’s reading the embedded data that was saved with the file). Go to the file menu, then file info. You’ll see a window with a list of categories on the left. Go to the Advanced category. Your window should look something like this. Delete the Adobe Photoshop Properties item and the item that just says http://ns.adobe.com/png/1.0/. Click ok, then save your file. The data in the file causing the color shift will now be gone and your images will match up with other image formats and hex color values correctly. It’s important to know that if you reopen the file in PS and do any sort of modification (allowing it to be saved again) then it may reapply the embedded data. One additional thing be aware of is that you can put these steps into an action to be reused at any time. It does seem to keep track of how the file info is modified when recording the action.

    I have no direct knowledge whether or not this color shift issue is still a problem with PNGs created within Photoshop CS3.

  24. Ken Says:

    wow, ask a question – get an answer…. many answers!

  25. Max Design - standards based web design, development and training » Some links for light reading (28/11/07) Says:

    […] Your Best Practices for Creating Great PNGs […]

  26. Confluence: Site Design Says:

    Some links for light reading - November 28th, 2007

    Fieldsets, Legends and Screen Readers

  27. Mike Cherim Says:

    This is a really old post on my blog, but it explains the beauty of re-optimizing PNGs to reduce file size while retaining a lossless quality. http://green-beast.com/blog/?p=32

    In a nutshell the article advises exporting the PNG, then opening the flattened PNG you exported and exporting it again. It’s a double optimization that has a significant impact to file size reduction while keeping the image quality high.

  28. Proflogistics Says:

    The more I develop websites, the more I have been concerning myself with image optimization. Put it this way, I used to crank up my image export compression setting to 100% in all cases.

  29. fwolf Says:

    Thanks to this article, I played a bit around and found a working solution for linux for at least 3/4 of all cases:

    1. use any app you like (eg. Krita, PS + Wine, Gimp) to create your image and save it as PNG image

    2. Note: if you’re simply doing some cropping or resize job, give gThumb a try - if the original image is in 8 bit, it sticks to that color depth, whilest Krita + Co. tend to set it up to 24 or 32 bit.

    3. use convert to reduce the number of colours to an appropiate level (eg. 128 colours == -colors 128)

    4. use optipng (in Ubuntu, just do a sudo apt-get install optipng to get it) to reduce its size once again - if needed, anyway. Normally ImageMagick does already a proper job ;)

    cu, w0lf.

  30. Steve Says:

    Great article. I have been trying to find stuff on PNGs. Thanks.

  31. Jeff L Says:

    thacker,

    thanks for the info. sounds a bit of a pain in the ass. :-) I’ll stick to the plugin for now, but would be interested to know if newer version of PS suffer the same issues.

  32. John Faulds Says:

    I export PNGs from Fireworks and then use pngOptimizer to reduce their file size.

  33. David Mead Says:

    I use Fireworks to export a PNG24 and then use PngOptimizer to reduce it which works great but, one problem we have come upon is that if you are using IE6 on a Dell laptop running at 120DPI (Dell ship them with that setting) the PNG’s display black artifacts.

    It sounds like a very isolated problem but we’ve come across a number of clients that have PCs set-up like this. We have yet to find out why this happens or a real fix for it.

    No such problem in IE7 or any other browser.

  34. Egor Kloos Says:

    It’s amazing the nothing, or at least very little, has changed in respect to producing PNG files. What on earth is Adobe waiting for? They make professional image/graphics software. You’d expect that would have fixed this PNG mess by now. I suppose this is what happens when a company effectively becomes a monopoly.

  35. Don Crowder Says:

    You and your peers breath a far more rarified atmosphere than I can tolerate so I’m reluctant to comment but good data is good data, regardless of its source, right? So, that being said, I’m very fond of Ken Silverman’s Pngout plugin in Irfanview. I’m able to decrease the color depth very nicely and then save with the plugin (there’s a check box in the options for png images). Transparency is also supported (yet another check box in the options). I sure wish Ken would create a Gimp plugin so I could use Pngout on my Etch machine.

    Hey Thacker what sort of remuneration would you require to teach me how to create png images which can rival jpegs for quality versus file size? Can you point me to some examples?

    (Gratuitous commentary from an aging, well-intentioned, geek-in-training)

  36. Jeroen Ruigrok van der Werven Says:

    I am surprised people did not even mention Paint.NET for Windows. It is a hell of a lot better user interface-wise than Gimp.

  37. thacker Says:

    Crowder–

    First thing, I am not a designer nor a developer, just a guy trying to learn like everyone else. Second, remuneration? Wouldn’t charge a damn thing, for christ sakes .. but thanks for asking.

    Every image, except for possibly two small gifs, on that Boinkin Chipmunks site is PNG-8. If you feel those images are the type of quality that you try to achieve, let me know along with what questions that you have. I will create whatever content pages are necessary to answer your questions and anyone else’s … via slide show, HTML and/or PDF — and Photoshop actions, if warranted. You may e-Mail me from the address listed on the Web site or post here.

  38. Àlex Corretgé Says:

    The GIMP is a very well tool to create PNG’s.

    I use it every time and get a good results.

  39. Mike Says:

    we gorilas in black tees

  40. Lone Star Says:

    I use Fireworks religiously. It’s perfect for creating PNGs. The bulk import/export functionality is especially nice when you have a lot PNG images to create all at once. Photoshop is nice too, but Fireworks is much easier to use.

  41. efge Says:

    A tribute to Ken Silverman: Pngout is the best tool to optimize pngs.
    Dos version is free, and the PngoutWin interface by Ardfry is really great. Batch compression, fine tuning of chunks…and best compression among optimizers. Check http://www.ardfry.com/pngoutwin/image_compression.htm for a test against Google logo.

  42. Michael Says:

    I use it every time and get a good results.
    Great Info.

  43. inşaat Says:

    thanks

  44. Fantasy Says:

    Great post and great Info. Thanks Molly.

  45. site ekle Says:

    thank

  46. varmısın yokmusun Says:

    like molly thanks

  47. hosting Says:

    very good

  48. molly Says:

    hey!

  49. molly Says:

    call me!

  50. Mathieu 'p01' Henri Says:

    specially now with alpha transparency support in IE7.O’RLY? have you tried to set the opacity of a PNG32 to something else than 0 or 1 in IE7 recently ? Saying that IE7 supports PNG alpha transparency seems a little premature to me.

    Anyway. Like many others, I’m using PhotoShop [+ PNGCrush]

  51. porno izle Says:

    thanx

  52. porno Says:

    thanx

  53. cinsel saglik Says:

    thanxx

  54. çeviri Says:

    nice log..

  55. firefox indir Says:

    thanks

  56. betsson Says:

    Good stuff. Thanks and greetings!

  57. Azure Web Design Blog Says:

    […] http://www.molly.com/2007/11/20/your-best-practices-for-creating-great-pngs/ […]

  58. uzaktan eğitim Says:

    Thanks Good Job

  59. toki Says:

    Thanks for helpfull information.

  60. mert Says:

    http://www.orgcu.net

  61. md altyapı Says:

    http://www.orgcu.net/

  62. samet Says:

    thanks for all

  63. samet Says:

    thaks so much

  64. webmaster, PHP, ASP, teknoloji, IRC, HTML, xmL, XHTML, » Blog Arşivi » pr6 pr5 pr4 dizinler Says:

    […] pr6 pr5 pr4 dizinler merhaba buyrun arkadaslar QuarkRuby: Ruby on Rails Security Guide pr5 molly.com Your Best Practices for Creating Great PNGs pr6 Friends for Sale Architecture - A 300 Million Page View/Month Facebook RoR App | High Scalability pr6 http://www.email-standards.org/blog/…ahoo-responds/ pr6 On Staying Creative | Graphic Define Magazine pr4 "Mike Tyson’s Brunch Out!!" - The Meth Minute 39 | The Meth Minute 39 pr4 Open Web Awards - Vote for Your Favorite Start Page pr6 Free Debates: A campaign to get FOX to do the right thing (Lessig Blog) pr5 Simkl and IM History: Two services that spy on your IM conversations (for you) | Webware : Cool Web apps for everyone - CNET pr5 Best Served Cold: Your thoughts on unit testing pr5 +rep isterım […]

  65. ilahiler Says:

    Thank you wery much

  66. ilahiler Says:

    :):) thank you friends beatifull open the box :D

  67. Dedektif Says:

    Thanks

Leave a Reply

Elsewhere

Roll Roll Roll