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.
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 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.
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.
Other PNG Features
PNG offers plenty of extra features including gamma correction, lossless compression, 48–bit colour, alpha transparency, and even multi–image files (animations, anyone?) via the MNG extension to the format.
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.
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.