Is there still any reason to prefer GIF over PNG when creating images for web pages? [closed]
Long ago, I used to avoid the PNG image format when building web pages because browser support was lacking. I remember having a PNG on a page could cause the QuickTime plugin to be loaded - yuck.
Today, every modern browser now supports PNG well and I'm using it in my web pages because:
- Compared to JPEG, PNG compression isn't lossy. Especially important for logos/drawings/charts.
- Compared to GIF, PNG isn't limited to 256-colors. Matters a lot with gradients.
In other words, with PNG, my images start looking sharp, and stay that way.
I can still see JPEG being useful because it compresses much better and loses very little visual quality for photos in particular.
And so my question is: What use cases remain for using the GIF file format in web pages? Is GIF now completely obsolete by PNG and its adoption, or are there specific things GIF is still good at?
Solution 1:
As far as I know, these are the only reasons:
AnimGIF. This animation works everywhere. There's APNG format, but it's not as widely supported, and has no real editing tools.
1x1 transparent graphic, assuming you care whether it's 80b or 120b. That's virtually the only case in which GIF gives smaller file size than PNG.
If you don't have proper tools for saving and optimizing PNG files. PNG files may contain color profiles and gamma correction information, which on the web cause more problems than they solve. It's best to have tool that removes this, making files smaller and more interoperable.
IE6 support is a red herring
The confusion comes from the fact that there are several color formats in PNG, and some of them are fully supported, and some of them are not.
Paletted PNG with 1-bit transparency (like GIF): work perfectly in IE6. Without any hacks.
Paletted PNG with 8-bit transparency (not possible in GIF): work partially in IE6 (degrade to 1-bit).
True-color PNG with 8-bit transparency (not possible in GIF): don't work in IE6 without hacks.
I'm 100% sure. I've tested it extensively. I'm using them on my websites. I've even worked on software that manipulates those files.
In short: if picture can be saved as non-animated GIF, it will certainly work as PNG, in all browsers, without hacks.
Solution 2:
They're useful for plugin-free animation, like Camtasia screencasts.
From: http://www.codinghorror.com/blog/archives/000583.html
Solution 3:
Is there still any reason to prefer GIF over PNG when creating images for web pages?
Only that PNG is not fully supported by some older browsers like IE 6.
According to MarketShare IE 6.0 still holds an impressive 24% of the browser market share, making it the most used browser version. No doubt this is caused by the corporate adoption and traditional slow upgrade policies. But it's a reality you must be aware of.
Note however that if you create flat PNGs, you should be fine. It's alpha-channel and transparent PNGs that are not supported.