Eleven days from now, the patent on LZW compression forming the basis of the GIF file format is set to expire, according to C|Net. They question whether this means the death of the PNG file format.

Not hardly.

PNG and GIF are not two competing file formats in a situation where you have to choose one or the other. They’re not black and white; they’re regular and extra strength.

PNG was created in reaction to the draconian licensing scheme Unisys imposed: creators of any software supporting GIF had to cough up a $5,000 surcharge whether their software was free or otherwise. This from a previously–open file format that was theoretically free to use. PNG was built in part to provide a free alternative, but also to better meet the needs of designers.

Now the licensing bait has been pulled out of PNG’s arsenal, so the only reason to adapt is technical. As we are all well aware, Microsoft’s Internet Explorer is the only modern browser that doesn’t support the alpha transparency that PNG offers. This, however, is not a reason to shun PNG until the situation improves. In a bout of ‘the grass is always greener’, I believe we’ve forgotten what it can and can’t do today. A brief summary is in order.

PNG, pronounced ‘ping’, is available in 3 flavours: true colour, grayscale, and palette–based. The former is better known as PNG–24, the latter as PNG–8 (24 and 8 bits per pixel, respectively) and these are the two that will concern us for now. 1–bit transparency means every pixel is either completely transparent, or completely opaque. 8–bit transparency means every pixel has an opacity value from 0 to 255, where 0 is completely transparent and 255 is completely opaque. Also see the accompanying PNG test suite.

PNG–8

PNG–8 is the GIF replacement. Allowing for custom–palette images ranging from 2– to 256–colour, it also offers a 1–bit transparency. This is exactly what GIF does, minus any hint of animation. File sizes are smaller, and support is consistent amongst all modern browsers. If you are using GIFs, there is absolutely no reason not to consider using PNG–8.

However, after considering it, there are still reasons why you may not want to actually use it. If you are exporting your images from Photoshop, you will consistently notice that your file sizes for equal PNGs are larger than the comparable GIF. This is a limitation of Photoshop, and highlights weak PNG support rather than any problem with the format itself. Work–arounds are possible by exporting from another more capable program like Fireworks, but that adds an extra step to the process.

See the first couple of comments to this article for plug–ins and third–party applications that get around Photoshop’s flaw.

PNG–24

Now we come to the heart of the matter. PNG–24 is the one we all want to use. Internet Explorer doesn’t support alpha transparency properly as we’re aware, which renders the main reason we wish to use it null and void. Such a great loss, we lament.

Except that we forget to consider also that PNG–24 is a lossless compression format, and in most cases we wouldn’t be able to accomplish what we’re dreaming anyway. Why? File sizes, my friend. If you compress a 400x200 image into a 25k JPG, you’re reasonably happy. That same image as a PNG with an alpha channel might hit 150k if you’re lucky, while 200k is more likely. A lossy PNG–24 will never exist either, because an alpha channel with compression artifacts would lead to randomly transparent pixels – something that is definitely not desirable.

PNG–24 is certainly great for some effects, and allows for amazing visual eye candy. But you will never build whole sites with it, not while bandwidth is a concern. It will remain a niche format even when widely supported, to be used only in situations when the 1–bit transparency of PNG–8 or GIF won’t quite suit the bill.

48–bit colour is absolutely useless on–screen. Your monitor displays 256 levels in each red, green, and blue channel per pixel. Each channel is represented as a single byte, hence 8 bits (1 byte) times 3 channels equals 24 bit colour. The next jump up to 48–bit colour involves doubling the bits per channel. A 16 bit red channel does not mean 512 levels of red though, it actually means 65,536. No monitor on earth displays that many levels per channel, and any advantages of having the extra colour are only realized when working in different colour models (which does us no good on the web).

I question the need for per–image gamma adjustment (as opposed to per-page) but I can see some practical applications of it, when considered outside of the context of the web page. Not every application of a graphic file is web–oriented. You may never use some of these features, but other graphics professionals may be hard–pressed to ignore them.

Conclusions

So we’re in a funny spot. We can use PNG on the web, but not fully. With a bit of elbow grease we can start using PNG–8 as the GIF replacement it was always meant to become. But that bit of extra work means it’s almost a sure bet that most professionals will avoid the challenge for now. A valuable addendum to the alpha transparency pressure on Microsoft might be found in calling on Adobe to work better optimization techniques into their software for PNG–8. Both issues are equal hindrances for PNG adoption.

PNG may gain dominance sooner or later, but despite it all, the 16 year old GIF file format is going strong. And while the patent news is good for the Free Web, it doesn’t mean PNG is going anywhere.

Comments are open on the Second Edition of the PNG specification until June 23rd, 2003.

Reader Comments

WRT to the size issue, SuperPNG is a free Photoshop plugin that does a much better job of compression.

Internet Explorer can do alpha PNGs as well using some ugly hacks. My personal favorite is this PNG behaviour, which is fairly easy to implement - the downside being that it only works on images specified in the HTML document (foreground images). A List Apart also featured an extensive PNG hacking article - which frankly turned my feeble brain to cheese. :)

I’m a fan of PNG and have been experimenting with it for awhile now, and using it where possible. With any luck bandwidth and browser support will come together in the near future to make using them possible.

An interesting little tidbit. Due to bloat and poor coding, MNG (the format that allows animated PNG’s) was removed from Mozilla’s trunk. I believe that MNG is still in for 1.4, so that means that Netscape’s and AOL’s (assuming…) next version should be able to use it. Since Camino doesn’t build from the tree, they should still have it until next time they grab the tree. However, new versions Mozilla Firebird and future versions of Mozilla won’t have that.

Basically, they said that nobody uses MNG, and the MNG decoder was the size of all the other image decoders combined (it statically used the JPEG decoder for instance).

I downloaded SuperPNG to see what it could do, but it only seems to spit out true-colour PNGs. So that doesn’t do much about PNG-8, which is a shame cause I’d rather have a plug-in than a third-party app. And PNG-crush is just plain silly — a command-line interface for an imaging tool? No thanks. The quest continues.

Minh - possibly. But the difference between solid CSS support and solid PNG support is that I can theoretically do my job well without the latter. Between XHTML, CSS, DOM, and PNG, I’d easily throw out PNG as the least important. WaSP had enough of a battle with the other three, let’s not fault them for that.

Mike - So I’ve heard. Sad, but true. You can’t fault their reasoning, I have yet to see a single MNG in the wild, but it strikes me as poor planning to just discard working code.

There are quite a few problems with PNGCrush. For one, you have to start with a bitmap: it only converts BMP files into PNG. Second, since it’s a command line tool, the interface is atrocious. You’re kind of expected to know the different kinds of compression (up, average, subsample, etc.) and somehow have the time to fiddle with these settings endlessly until you get something that works.

I decided to use PNGCrush to compress a 24-bit-color BMP file to a 24-bit-color PNG. The resulting file size was bigger than with Photoshop 7, even with maximum compression enabled. Heck I tried every setting possible, and Photoshop’s file size is still smaller. Same was true with an 8-bit-color PNG. In addition, PNGCrush can only convert BMPs using 24-bit or 8-bit color.

I think PNGCrush is primarily designed for research settings where students and researchers will be converting large sets of test images into PNG files.

Hmmm. I just did another test with Photoshop 7, this time comparing file sizes when saving as an 8-bit color PNG versus saving as a GIF. There doesn’t seem to be any appreciable difference. Sometimes the PNG is smaller by a wee bit (a couple of hundred bytes), sometimes the GIF is smaller by the same amount. Maybe Photoshop 7’s PNG engine has been redesigned.

After having used it myself 0 times and evaluating it solely on lack of features and hearsay, I’m going to save everyone a lot of time and declare PNGCrush useless for my workflow, and probably most other people’s as well.

I discovered that SuperPNG does work as 8-bit PNG, by first converting your image file to indexed color and then saving as PNG. It’s too cubersome though, I wish it replaced the Save for web PNG8/24 instead, since now I can’t remove similar colors to gain better compression myself, which is one of the best features of save for web imho.

It’s unbelievable that so many years after PNG is a standard it’s still not supported well in web browsers, but the fact it isn’t well supported in capable imaging applications is just unreal. If the support in the latter apps would be better, support in webbrowsers wold just be a question of time.

Makes you think what other echnologies nowadays aren’t used to their full potential (perhaps as a strategic / marketing decision). bleh.

I downloaded SuperPNG to see what it could do, but it only seems to spit out true-colour PNGs.

I’ve been using Photoshop’s Save for Web for 8-bit PNGs, and like Sherif, see little difference between them and GIFs WRT file sizes.

I guess the only real reason to use them anyway is to promote an open format, are there real advantages to 8-bit PNGs over GIFs?

I find pngcrush to be useless for me too, because I need to use it on the command line in OS X. So in short, use Save for Web for 8-bit PNGs and SuperPNG for true-color PNGs.

BTW one thing I’ve noticed is that SuperPNG true-color files often appear larger in the Finder because PS saves a preview with them as well. This may only occur in OS X, but they shrink when I upload them to an FTP server.

I guess the only real reason to use them anyway is to promote an open format, are there real advantages to 8-bit PNGs over GIFs?

Theoretically, they’re smaller, If you have a program that exports them properly a PNG-8 should be x% smaller than the same GIF. I don’t know what x is, but 20% feels safe, 40 or 50% in extreme cases perhaps.

Dave stated that png-8 has 1bit transparency. I’m not sure how it works, but when you select png-8 export form Fireworks, you can choose alpha transparency and have multiple shades of transparency. So it would seem that it offers more than 1 bit transparency?

No I mean VML as I prefere VML above SVG as it is natively supported by IE. Apart from the stunning filter effects of SVG (Although very slow to render) VML can do about the same. (Used Adobe’s Behavior class version of its renderer a while for embedded inline SVG in IE but that version of SVG3.0 is buggy as confirmed by Adobe.)

Anyway. Have to saleep now but I have one example of a PNG in a VML rect. The page uses SAPI4 and TTS engine on top of that so be prepaired. Tomorrow I’ ll post some others. Including some JScript-SMIl animations in Fullscreen)

Well, I’ve been screwing around with your code for the past hour, and doing a bit of Googling to support what I’ve found. My simpler test, without the vocalization (what’s up with that, anyway?)

Problem being that VML was a Microsoft-dominated submission to the W3 for consideration, and never went any further. So it’s supported in IE, but it’s about as non-standard as you can get.

It’s actually an application of XML though. Which leads me to think there might be some way to rig it into a valid XHTML page. I have no confidence that any other browser would support it, but who knows - maybe with a bit of scripting it could become a more standards-based PNG solution than Michael Lovitt’s IE Filter hack.

Interesting possibility, William, thanks for bringing it up. I can’t go any futher with it given my complete lack of knowledge of XML, but here’s hoping someone else can take this discussion and run with it.

Noting here for the archives: I found a similar article by Mark Pilgrim that links a few resources.

It seems that I may have written off PNGcrush a bit early. Rather than use it to build my PNGs, I have the option of batch-compressing, say, all PNGs in a directory. You know, that’s not such a difficult step to take: Export from Photoshop as PNG, then crunch further before launching.

Dave,
Reading Back feature is unrelated to the PNG issue, but that was the first sample I dug up from my archives yeserday. (If you install the Sapi4 runtimes (not installed on XP by default) from www.microsoft.com/msagent ) and you have the truvoice TTS installed , you will hear your text read back and the word spoken highlighted, it is so Coool).

VML is abit of amother/elder Sister of SVG and it didn’t make in W3C circles all the way while SVG did, however as over 90% of browser usage is IE5 to IE6 , I and the rest of the 90% web surfers are not concerned with other browsers. (In secret I have fallen in love with Firebird though these last two weeks).

As you can see from your simplified test page , it is very easy to use in IE, check back to my RSS feed today or the links at http://cybarber.ath.cx/index.htm for some other PNG-VML_SMIL compositions.

As promissed I made a pretty cool demo of things PNG, VML, XML, Xpath, XSLT, RSS and a nifty drag and drop for a VML container to the greater glory of Internet Explorer.

If it is just for simply browsing of css styled text and images without too much fancy stuff, I go for Firebird now as with all its extensions it is a real userfriendly browsers. But for the real multimodal Dynamic adventure on the edge there is only IE6, but its good to have some competition again.

Command line tool also means: it builds quickly and without problems on a whole number of platforms, it is easily scriptable, and as a extension of that, graphical frontends are possible (cf. tidy and tidygui).

> You’re kind of expected to know the different kinds of compression (up, average, subsample, etc.) and somehow have the time to fiddle with these settings endlessly until you get something that works.

That’s not true. If you just feed it one image without any further options, it tries the five statistically best methods, and within seconds, you have a smaller filesize.

> I decided to use PNGCrush to compress a 24-bit-color BMP file to a 24-bit-color PNG. The resulting file size was bigger than with Photoshop 7, even with maximum compression enabled. Heck I tried every setting possible, and Photoshop’s file size is still smaller. Same was true with an 8-bit-color PNG.

I imply that cannot be true. If you have tried every setting possible, you must have found the -brute switch, which tries 114 different methods, at the expense of time. I challenge you to publish your images. Else, thanks for playing, but lies fly away in the face of fact-checking.

Well this article seems to be dead, but I feel obliged to point out that OSX users can set up an Applescript folder action on a directory to automatically compress .pngs saved there with PNGCrush. A lot easier than doing them by hand.

One more point to add to the fray - my first few test with Photoshop gave me the results I quoted above. Further testing says that for larger images, PNG actually saves rather well straight from PS. I’ve achieved 40% reductions for 300x200 images, no fancy tricks. Still only one-bit transparency, but the situation is looking better.

Ahhh, I goofed. I used the wrong software when testing pngcrush. I downloaded the png2bmp utility instead of the pngcrush executable. Thanks to Trollhunter for setting me straight. One of these days I’ll learn to think before I fire off replies to bulletin boards.

Dave, is there any way to have my earlier post deleted? Hope you have another seat at that crow dinner :-)

Thank you for a very well presented overview. I’d like to comment on two issues. First, alpha transparency for Windows MSIE.

I’ve had a PNG section on my site since February 2003. I haven’t linked to any of the well known JavaScript fixes for two reasons: (1) they seem so darned complicated, and (2) a significant proportion of non-tech internet users surf the net with JavaScript disabled to avoid pop-up windows and other annoying tricks. Tech-savvy surfers know how to install applications which protect them from malevolent JavaScript, so the JS statistics for sites which they frequent can be misleading.

In my own tests with JavaScript alpha transparency hacks I’ve found that they don’t work on every system. I uploaded two test pages to my site and accessed them with IE6 on Windows98 and Windows 2000. One test page used the ‘strict’ doctype and the other one was ‘transitional’. The results were not the same on both systems. On Windows 2000 the PNGs disappeared on the ‘strict’ page but showed up OK on the ‘transitional’ page. On Windows98 the PNGs disappeared on both pages. With IE5.5 for Windows95, both pages worked fine.

One possible explanation is that once the AlphaImageLoader filter has crashed, due to incorrect coding or markup, it stays resident and may not be able to render correct pages either. It looks like thorough testing could be very time consuming.

I’ve come across many misconceptions about PNG transparency in design forums. I need to find a discussion forum dedicated to AlphaImageLoader hacks, where the participants have done thorough testing. I would really appreciate it if anyone knows of one and could post a link.

The second issue is SuperPNG, the free Photoshop plug-in for compressing PNGs. On the SuperPNG samples page there’s an image called “pnggrad8rgb.png”.

However, SuperPNG is available as a Photoshop plug-in, and it’s free. Web Image Guru is designed to be used as a PhotoShop plug-in or as a standalone application, but it costs $39. IrfanView is free, but it’s not available as a plug-in. Web Image Guru offers filtering options (usually unecessary), while IrfanView uses adaptive filtering, which is the standard method for most applications.

Web Image Guru compression can match pngcrush for 8_bit paletted PNGs. It also has some features that pngcrush doesn’t have – palette editing and the option to reduce the number of colors. It does batch processing too. Buying it was the best $39 I ever spent.

Based on personal observation I find this a bit hard to believe. Non-tech internet users (that i’ve encountered) not only are incapable/unwilling to change browser default settings, but really don’t know enough about JavaScript to make the connection that disabling scripting in the browser would prevent pop-ups from spawning. I think if you’ve made that connection all on your own, then you aren’t quite a “non tech internet user”.

I didn’t make the the observation about non-tech users surfing the net with JavaScript disabled on my own. Every national newspaper in the UK includes an internet section at least once a week (both quality newspapers and tabloids). I regularly see tips about how to stop pop-ups, how to remove ISP branding from Internet Explorer, and other common annoyances. Readers write in with these kinds of questions all the time. From among my own aquaintances several non-tech internet users have asked me how to stop pop-ups, but then baulk at the idea of having to install a special application program. Global statistics on JavaScript usage are available from: http://thecounter.com/stats/2003/May/javas.php

Search this site:

About This Entry:

You are reading “A PNG Review”, an entry posted on 9 June, 2003, to the Placid collection. See other posts in this collection.