IE6 Transparent PNG Fix

After years of messing with various solutions for the IE6 PNG transparency issue (if you don't know what that is, prepare to be bored out of your skull) which mostly involve a Javascript file that rewrites the page to take advantage of an IE-only CSS filter that renders the PNG images with correct backgrounds instead of a grey background. 

The trouble with most of those solutions is, when you apply them your links and input elements often go unclickable.  So you have to jump through yet more hoops for IE6 users, most of which require extra code and lots of headaches.  

I'm pleased to announce that today I stumbled on this astounding method of creating a PNG file that does away with all of the cross-browser issues of transparent PNG files: in modern browsers, the PNG transparency uses an alpha mask, so has the pretty anti-aliased edges and dropshadows that make you want to use PNG in the first place.  And in IE6, the PNG just treats all those semi-transparent pixels as transparent, so you get what you would have gotten using a GIF anyway.  I'll tell you how in a minute.



Wednesday February 3 2:7 PM
3232 Blog     RSS Feed RSS
The 3232 Design Blog is here to help you with your small business marketing and graphic design needs. If you feel your needs are not being met, please post a comment and it will be answered in the order in which it was received.
IE6 Transparent PNG Fix
RSS Feed

After years of messing with various solutions for the IE6 PNG transparency issue (if you don't know what that is, prepare to be bored out of your skull) which mostly involve a Javascript file that rewrites the page to take advantage of an IE-only CSS filter that renders the PNG images with correct backgrounds instead of a grey background. 

The trouble with most of those solutions is, when you apply them your links and input elements often go unclickable.  So you have to jump through yet more hoops for IE6 users, most of which require extra code and lots of headaches.  

I'm pleased to announce that today I stumbled on this astounding method of creating a PNG file that does away with all of the cross-browser issues of transparent PNG files: in modern browsers, the PNG transparency uses an alpha mask, so has the pretty anti-aliased edges and dropshadows that make you want to use PNG in the first place.  And in IE6, the PNG just treats all those semi-transparent pixels as transparent, so you get what you would have gotten using a GIF anyway.  I'll tell you how in a minute.

Does Spam Work? - 05/23/11
Tiny Planets - 03/29/10

Show all blog entries

First, let me start by saying that if you are viewing this site in IE6 right now and you are capable of upgrading your browser, you are the scum of the Earth and do not deserve decent transparent PNGs.  The world would be a better place if IE6 just fell off it.  However, since many corporations have mandated IE6 and don't allow their users to upgrade because IE7 broke all the custom code their intranet uses, we web designers have to just put up with it.  

Like I said, up until now I've had to either design very carefully, or come up with an alternate solution for displaying transparent PNGs.  I used to use conditional comments for IE6 and use a GIF in that style sheet and a PNG for everyone else.  IE6 is still 1/3 of the browsing market, a minority that is far too large to just ignore.  And many of them can't help it, either.

So while struggling with various Javascript methods of fixing all the PNGs in a site, I stumbled upon a simple, almost magic solution: Fireworks.

If you have Fireworks, you can do this.  If you do not have Fireworks, you probably can't.  Like I said, this is not a code fix, this is an image fix.  The idea is to save the PNG-24 with alpha transparency as a PNG-8 with alpha transparency.  Modern browsers will read the alpha mask, and IE6 (the stone-age browser) will see what is basically a GIF because it ignores the alpha transparency and just considers it all transparent.

This means that the fix won't work for all images, but for 98% of them it will.  Here's how to do it:

STEP 1) Open your PNG in Fireworks.

STEP 2) Go to the OPTIMIZE tab (Window -> Optimize, or F6) 

STEP 3) Change the graphic format from PNG 24 to PNG 8

 

STEP 4) Change the transparency dropdown to 'Alpha Transparency'.

 

STEP 5) Add your preferred amount of diffusion.  If you have gradients, you may want more diffusion or you'll get banding.

STEP 6) Go to File -> Export and Export it.

STEP 7) Crow to anyone who will listen about your mad web sk1llz.

 

Seriously, it doesn't sound like it would work, but it does.  It looks reasonable on IE6 and even more reasonable on everything else.  It's not a PNG-24, so don't use it if that's critical to the design, but nine times out of ten this fix will be all you need.

Here's an example.  Check it out in IE6 and any other browser.  Cheers!

The magic IE6 transparent PNG

Comments
IE6's days officially numbered? - chris Bowlsby, Saturday, February 20 2010, 09:45 AM
Richard, I'm so glad you found a workaround for this! That's awesome! At almost the same time Google has taken another tack: rather than figuring out how to help those people that are using IE6, their simply cutting them off from Gmail, Google Apps, and Google calendars. With a giant like Google pushing "advancement" to IE7 (a 4 year old browser) or later maybe your elegant solution will become unnecessary. http://tiny.cc/5DVhU Cheers, chris bowlsby bowlsbyphoto.com

Not working fine - AshokPraba, Friday, August 6 2010, 01:49 AM
Not working fine, the result image hasn't smoothness . it shows without anti aliasing

Re: Not working fine - Richard, Friday, August 6 2010, 08:31 AM
You're right, in IE6 the images don't look that good. This fix won't work for every situation, but if you just need bare minimum support for IE6 or the graphics are on the right backgrounds then it's fine. This fix won't work for images that are entirely semi-transparent as IE6 will make them entirely transparent. But often for IE6 a little aliasing around the images is better than gray boxes. If you need perfection in IE6, you need to use a more comprehensive coding solution like iepngfix.

found a fix - Trading Guy, Wednesday, February 16 2011, 12:38 PM
I tried this on my website - "DD_belatedPNG" and it worked great!

Re: found a fix - Richard, Wednesday, February 16 2011, 12:44 PM
That's a good one, too. All of the IE6 js png fixes work the same way, by replacing the png with an element using the png as a background and applying a Microsoft transparency filter. This can cause problems in certain layered elements, stealing click events. It doesn't happen often, and when it does an image fix is the only way to get around it. But for most applications, the js png fixes like DD_belatedpng work like a charm.

Fantastic - Shekhar, Thursday, December 8 2011, 12:41 AM
Hi, Fantastic idea. it works.

Add Your Comment:
Your Name:
Email Address or URL:
Title of Comment:
Comment Body: