[mapguide-trac] #1518: PNG8 color quantization uses too few colors
resulting in changing colors in small pans
MapGuide Open Source
trac_mapguide at osgeo.org
Fri Nov 5 11:30:29 EDT 2010
#1518: PNG8 color quantization uses too few colors resulting in changing colors in
small pans
---------------------------------+------------------------------------------
Reporter: gabrimonfa | Owner:
Type: enhancement | Status: new
Priority: low | Milestone:
Component: Rendering Service | Version: 2.2.0
Severity: trivial | Keywords:
External_id: |
---------------------------------+------------------------------------------
Mapguide 2.2RC on centos5
PNG8 visual quality is much more appealing than JPEG especially in text
and thin lines. However actually it has one problem that may prevent its
adoption.
Even doing very small pans objects may change sensibly their colors, which
is visually disturbing
Have a look to the right upper corner in
* map_png8_1.png
* map_png8_2.png
or at the darker pink polygons in the lower part of the map.
I was wondering if this is inevitable due to the color quantization or
not, thus I've made some tests.
First of all, look at the PNG image corresponding to the first image
* map_png_1.png
Looking at the number of its colors (map_png_1_info.png) it has 16238
different colors.
Obviously map_png8_1.png is limited to 256 colors, but the first surprise
is that the PNG8 version has only 135 colors (map_png8_1_info.png).
'''First question''': why the algorithm of color quantization uses so few
colors?
Then I try to reduce the number of colors in the PNG version transforming
it in a palletted image
* map_png8_1_gimp.png (and map_png8_1_gimp_info.png)
obtaining an image with 256 colors, which colors are much more like the
original one w.r.t. to Mapguide produced one.
I then force GIMP to use only 135 colors, in order to see if it is
possible to have better results also with fewer colors
* map_png8_1_gimp_135.png (and map_png8_1_gimp_135_info.png)
The answer is yes, the image is a lot better that that obtained by
Mapguide
'''Second question''': is it possible to improve the quality of the color
quantization?
Even if each pan does an independent color quantization, if the obtained
image is very similar to the PNG original one, probably the images
obtained with small pans also look similar between them.
And the problem would disappear.
'''Third question''': is it possible to preserve the stylization colors of
the objects in the map if the number of colors involved is less than 256?
I've seen that this has been addressed for base layer in
http://trac.osgeo.org/mapguide/wiki/MapGuideRfc60.
Would be possible to adopt a similar solution for all the layers?
I mean, probably it is more wise to preserve these colors and changing a
bit the colors used for smoothing around lines.
Even with a lot of transparencies, as in my examples, we're probably under
256 "stylization colors".
This claims is confirmed by the fact that even with only 135 colors GIMP
is able to produce an image which at first sight is quite similar to the
original one
--
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/1518>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals
More information about the mapguide-trac
mailing list