transparent png in Internet Explorer

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ridera

Post by ridera »

It can be done, but, it's messy.

IE7 will fix the problem. All decent browsers handle pngs.

I handle it by generating a gif version just for IE6. Then I check if the client's browser is IE6. If so, I send the gif version.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I do not know how to do it in ImageMagick but I think you need to go to 8 bit and have index transparency or something.
SharkD
Posts: 35
Joined: 2006-07-30T13:18:31-07:00

Post by SharkD »

You can also embed the PNG image in an SVG document.
SharkD
Posts: 35
Joined: 2006-07-30T13:18:31-07:00

Post by SharkD »

rain wrote: If I embedded it in an svg would my users then need a plugin for svg?


Yes; but then it would work in all browsers.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

IE6 will only handle PNG transparency in a very limited format, basically the same as a GIF image.

Your solutions
Convert images to GIF or JPEG
This may require you to 'flatten' any semi-transparency pixels onto a background that is suitable for your web pages, using method described in IM examples for GIF Image Handling
http://www.cit.gu.edu.au/~anthony/graph ... ats/#trans


Add some sort of PNG image handler for IE6.
This is tricky and a number of variations exist. Usally they use soem java code that overlays the image onto the page so that semi-transparency works.
For one example (and other links) see http://www.cit.gu.edu.au/~anthony/wwwlab/pngtest/

Require users to get a decent browser IE7, firefox, etc etc etc
This will be the solution in a few years, but it is a little much to expect from a general user at this time.



That is your choices, take your pick.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

Anthony here is a link to an image somebody did for me to prove you could get IE to display a png with transparency. The quality of the edges is not as good as the pngs normaly are due to losing the semi-transparent pixels. Basicly as you said it is a gif.

The guy would not tell me how he did it ( he didn't use ImageMagick ) but hinted that you should not use the alpha layer for the transparency. I have searched the net and thats where I found the referance to using an 8bit image.

Thats 2 options to look into; how would you go about it? I had a play around but did not really know what I was doing and so could not get a result.
I could not get identify to work either so can not see the image information.

http://www.rubblewebs.co.uk/imagemagick ... re_png.php
GiantRabbit

Post by GiantRabbit »

It's possible to work with 24 bits PNG's (RGBA) in IE, that is by referencing a "behavior" script.

See http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html for the script and a description.

Besides that, by generating a 8bits (== 256 colors == indexed color image) for IE from a 24bits PNG is not a true option, except when using the pngbehavior method. Because IE does not do proper color correction (color management) on displayed PNG's.

So, in IE don't use PNG at all, unless you use the pngbehavior.htc script. Else use GIF, PNG or BMP.

*edit*
Crap I just saw Anthony was already pointing u to that direction.
Post Reply