[mapserver-users] Re: [mapserver-dev] AGG/PNG && QUANTIZE_FORCE && --with-experimental-png => bad IE6 rendering
David Fuhry
dfuhry at acm.org
Sat Sep 20 11:35:50 PDT 2008
(Apologies for cross-posting. There is no mapserver bug here, only a
browser limitation workaround which might be helpful to some users.)
Mapserver's AGG/PNG driver w/ QUANTIZE_FORCE=ON and TRANSPARENT ON
generates an 8-bit PNG with per-palette-entry alpha transparency. If
you use a transparent background, you'll face a problem: IE6-
(incorrectly) only renders pixels with a very high opacity. The
attached script rewrites an 8-bit PNG's tRNS header, making all
non-completely-transparent pixels opaque. (It is easy to modify this to
use a threshold > 0.) The attached script, reimplemented at the
tilecache level if the requesting User-Agent matches /MSIE (5\.5|6)/,
worked well for me because:
1. Mapserver always renders AGG/PNG. No need to special-case GD/PNG to
get transparent images for IE6-. No need to cache duplicate images.
2. Avoids having to use the IE 5.5/6 PNG alpha-transparency hack, which
decimates performance [1].
Hope someone else might find this useful too.
-Dave
[1] http://trac.openlayers.org/ticket/77#comment:2
David Fuhry wrote:
> I generated the attached tile.png with AGG/PNG and QUANTIZE_FORCE=ON,
> using a --with-experimental-png build of mapserver (to get PNG-8
> transparency). It's an 8-bit PNG image with a transparent background.
> The image looks great in every browser except IE6, which only renders
> certain pieces of lines (see other attached image). Is this a known
> problem?
>
> I've tried INTERLACE=OFF with no success. Changing the driver to GD/PNG
> works, but of course I don't get the AGG smoothness. There is no
> AGG/GIF driver yet, so that's not an option. And finally, a 24-bit PNG
> is not an option since IE<7 doesn't support alpha transparency.
>
> I'm now beginning to wonder if the misrendering is due to alpha
> transparency (not supported by IE6-) on the 8-bit image. I didn't think
> that 8-bit PNGs supported alpha transparency (GIFs don't) but according
> to this article:
> http://www.sitepoint.com/blogs/2007/09/18/png8-the-clear-winner/ indexed
> PNGs can store alpha channel values for one *or more* palette entries.
> If this is the case, then a welcome FORMATOPTION might be
> QUANTIZE_ROUND_TRANSPARENCY which would round palette entries'
> transparency up to 100 or down to 0. Hmmm... but then (since there's no
> background color) AGG smoothness would be lost, and one might as well
> use GD/PNG, so maybe not.
>
> I'll look into the IE htc (css behavior: ...) hack as a possible
> solution. Better suggestions appreciated.
>
> Thanks,
>
> Dave Fuhry
>
> OUTPUTFORMAT
> NAME "AGG_PNG8"
> DRIVER AGG/PNG
> IMAGEMODE RGB
> FORMATOPTION "QUANTIZE_FORCE=ON"
> FORMATOPTION "QUANTIZE_COLORS=256"
> FORMATOPTION "INTERLACE=OFF"
> TRANSPARENT ON
> END
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: palette.py
Type: text/x-python
Size: 2479 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080920/58f2c6dc/attachment.py>
More information about the MapServer-users
mailing list