Question

I'm working on a website that uses lots of png24 files, for transparency.

I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly.

See this link to get an idea of the symptoms IE6 displays - http://blogs.cozi.com/tech/2008/03/transparent-pngs-can-deadlock-ie6.html

Does anybody know an easy way of targeting existing png24 files, to replace them with the png8s?

I'm using a OS X, and file browsers like Adobe bridge don't show this, nor can I find the info on the commandline, or the finder.

Help!

Was it helpful?

Solution

The file utility on OSX can tell you the colour depth in a PNG file, e.g:

% file foo.png 
foo.png: PNG image data, 1514 x 1514, 8-bit grayscale, non-interlaced

OTHER TIPS

You actually CAN get alpha transparency in PNG-8's but it's super complicated. http://www.sitepoint.com/blogs/2007/09/18/png8-the-clear-winner/ http://www.personal.psu.edu/drs18/blogs/davidstong/2007/09/png8_alpha_transparency_from_f.html

It basically creates GIF like substance for IE6 and a real PNG with alpha transparency for better browsers. It's a more pleasant degradation path. Right now, I think you need Fireworks, but I am exploring other options.

To add to Alnitak’s answer, once you find all PNG24 you want to convert, you can batch them all with pngquant:

pngquant -v -f --ext .png 256 *.png

This converts all PNG files to PNG8 in place, overwriting them.

I think you might be asking the wrong question. PNG8s don't have the true-alpha you've been working hard to fix in IE6. If you replace the PNG24s with PNG8s you are no better off than replacing them with GIFs.

Maybe you could test an alternative replacement/fix script - there are some shockingly bad ones out there, maybe that's where the problem is?

Here's (and I say this tongue in cheek!) the right question.

JoeBloggs is right, you're asking the wrong question.

I've never had IE6 break with a good pngfix script. You've either got a bad pngfix script, or a bad IE6 install.

PNG8 will ruin your nice transparencies and make it look like you're using GIFs.

pngcheck, a command line tool, can dump the information you need. http://www.libpng.org/pub/png/apps/pngcheck.html

pngcheck.exe a.png
OK: a.png (1024x1024, 32-bit RGB+alpha, non-interlaced, 80.7%).

pngcheck.exe b.png
OK: b.png (1024x1024, 8-bit palette+trns, non-interlaced, 83.1%).

Perhaps imagemagick helps you out at converting png24 files to png8 files.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top