Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

closed as off topic by random Oct 5 '12 at 20:35

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    

3 Answers 3

up vote 15 down vote accepted

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.

  1. Paletted PNG with 1-bit transparency (like GIF): work perfectly in IE6. Without any hacks.

  2. Paletted PNG with 8-bit transparency (not possible in GIF): work partially in IE6 (degrade to 1-bit).

  3. 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.

share|improve this answer
1  
I'm sorry but I had to downvote. This information is not correct. Please refer to support.microsoft.com/kb/294714. You need to apply a filter. –  A Dwarf Nov 9 '09 at 2:55
8  
@A Dwarf: I'm 100% sure that PNG 8-bit with 1-bit transparency (GIF-like) works perfectly in IE6, because I'm using it. Have you even tested it? What you've pointed is required for PNG 24-bit with 8-bit (not-GIF-like) alpha channel. These are not the same. –  porneL Nov 15 '09 at 23:13

They're useful for plugin-free animation, like Camtasia screencasts.

enter image description here

From: http://www.codinghorror.com/blog/archives/000583.html

share|improve this answer
    
And then there is APNG (en.wikipedia.org/wiki/APNG), as we were talking about modern browsers... –  Jawa Oct 25 '09 at 20:44
    
APNG, eh? I always thought the job would go to SVG upload.wikimedia.org/wikipedia/commons/0/01/…. –  hyperslug Oct 25 '09 at 22:36

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.

share|improve this answer
    
Resistance to Vista's adoption has helped allow XP (and its default browser, IE6 ) remain popular. Windows 7, and not Vista, will likely take over XP's user base eventually, so hopefully those numbers will decline. –  hyperslug Oct 25 '09 at 19:34
1  
I guess if you tend to use single pixel transparent GIFs in your web designing you might want to stick with GIF as the PNG may show up as a grey dot in IE6. –  hyperslug Oct 25 '09 at 19:46
2  
Please look at porneL answer to see why IE6 is NOT a problem for PNG –  Vincent Robert Nov 9 '09 at 1:41
    
porneL speaks of 1 color transparent pngs. I speak of full alpha channel transparency. Maybe if you read my answer better? Also see my comment to his post regarding 1 color transparency pngs. –  A Dwarf Nov 9 '09 at 2:54
1  
A Dwarf: All GIFs are 8-bit, so you never need 24-bit PNG to represent a GIF image! The fact that 24-bit format doens't work is irrelevant to PNG/GIF debate. You're only spreading confusion. –  porneL Nov 15 '09 at 23:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.