[mapguide-users] patch for Ticket #743 / png8 transparency

Gabriele Monfardini gabrimonfa at gmail.com
Fri Sep 21 09:10:43 PDT 2012


> Take a look at this
> http://trac.osgeo.org/mapguide/ticket/743#comment:15
> <http://trac.osgeo.org/mapguide/ticket/743#comment:15>
> The patch only affect png8 output. As the actual png8 output has really a
> poor quality it's quite safe to apply this patch on the 2.4 branche.
> Test image before patch
> <http://osgeo-org.1560.n6.nabble.com/file/n5003596/trans_mapguide_png8.png>
> Test image with patch
> <http://osgeo-org.1560.n6.nabble.com/file/n5003596/new2_mapguide_png8.png>

I've always used PNG8 in my maps (except for overlay since as you
noted Mapguide was unable to handle partial transparency in overlay).

I've seen defects like  "Test image before patch" if I have a
background polygon layer (a.k.a. sort of state limits or the like) and
I set it to off from the legend.

With a filled "background" layer lines and text are rendered
correctly, without they are subsampled (low res) as in your "Test
image before patch".

This however has a simple workaround, to add a "background" layer
which cannot be toggled off by users.

The only real drawback of using PNG8 imho is the bug that I described
in ticket http://trac.osgeo.org/mapguide/ticket/1518.

The proper solution to the bug is to preserve exactly the color that
has been chosen in map layers if their number is below the 256 entries
in the palette.
A sort of color quantization with some centroid color fixed.

Otherwise even a small pan may discover a part of the map with
different colors w.r.t. the rest and color quantization may lead to
different palette entries.
This is quite visible where you have large filled polygons, which
colors drift significantly or in cases when colors are prescribed and
should not be modified.
It also affects map readability since colors drift from their legend entries.

I'm willing to test your patch since it may be a good mapguide enhancement.


Gabriele Monfardini

More information about the mapguide-users mailing list