[mapguide-internals] PNG8 color problems

Trevor Wekel trevor_wekel at otxsystems.com
Thu Feb 25 16:04:01 EST 2010


Hi Gabriele,

In MGOS 2.1, the PNG8 palette is evaluated for each map render using the gd Library gdImageCreatePaletteFromTrueColor method.  According to the documentation, gd uses a "high-quality two-pass quantization routine".  You might be able to find more information on it with a web search.  It seems to do a good job on colors which occupy a lot of screen real estate and a "less than ideal" job on colors which only occupy a few pixels.

Since the palette is evaluated on each request, it will change depending on what is currently displayed.  This means features could change color as they are panned across the screen.

In MapGuide 2.2, the palette is calculated by looking at layer stylization http://trac.osgeo.org/mapguide/wiki/MapGuideRfc60. This does a much better job at retaining the colors you have selected on your map.


Thanks,
Trevor

-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Gabriele Monfardini
Sent: February 25, 2010 11:19 AM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] PNG8 color problems

Hi all,

I'm using Mapguide 2.1 on Windows, with OGR Provider.

Using PNG format, output quality is very good but images are far too big.
Using JPG format, images are reasonably small but lines and small symbols show some blocky artifacts.
Thus I'm playing with PNG8 that seems by far to be the best compromise.

How is PNG8 palette evaluated? Which color approximation algorithm is used?

In fact it appears that the same object changes its color depending on the other colors on the scene.

For instance, turning on a blue point layer, gray objects become bluish and dark pink areas became darker (see attached images, in the same extent, with and without the point layer).
I don't think there are so many different colors on the original map to justify such an evident color change when restricting to a fixed size palette.

In my applications this change is not acceptable, since a lot of time is spent in choosing correct colors and they are not allowed to vary so much.
Moreover the visual effect is a little disturbing for users.

Is there any parameter that I can tune? Do you think this is a bug?

Regards,

Gabriele


More information about the mapguide-internals mailing list