Saturday, October 29, 2005

GIF vs PNG

Today, I test my homepage with IE. IE cannot display transparent PNG graphics properly, and the background becomes grey in color.

Fortunately, I find a workaround on the Web -- http://homepage.ntlworld.com/bobosola/. It has details about the problem and how to solve it. In short, it uses javascript to patch all <img> tag of PNG graphic's CSS using the "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" of IE.

Actually, PNG has some advantages over GIF.

  1. Max color depth of PNG is 24-bit but that of GIF is 8-bit.
  2. PNG has higher compression rate than GIF.
  3. PNG support alpha channel transparency but GIF only support binary transparency.
However, GIF supports animation but PNG not. This is a weak point of PNG.

Related Links:
AlphaImageLoader Filter
PNG Offical Site

No comments: