AGG, paletted image and transparency (Mapserver 5.0 beta 5)

Gilles Bassière gilles.bassiere at MAKINA-CORPUS.COM
Thu Aug 30 10:44:41 EDT 2007


Hi List,

I run Mapserver 5.0 beta5 as a WMS server and have some troubles with 
background transparency :(

In a first attempt, I just replaced my GD OUTPUTFORMAT definition by:

OUTPUTFORMAT
   NAME             "png"
   DRIVER           "AGG/PNG"
   MIMETYPE         "image/png"
   IMAGEMODE        "rgba"
   EXTENSION        "png"
   FORMATOPTION     "transparent=on"
   # TileCache can't use meta-tiling on interlaced PNG files...
   FORMATOPTION     "interlace=off"
END

Changed my config to have my OpenLayers pointing directly at Mapserver 
5.0, launch my browser and... Wow, it looks great !!!

Then, I tried some optimization and I added to my OUTPUTFORMAT element 
(as seen in "AGG rendering specifics" howto) :
   FORMATOPTION     "quantize_force=on"
   FORMATOPTION     "quantize_dither=off"
   FORMATOPTION     "quantize_colors=256"

Well, the line work is still beautiful but I now have 2 problems :
1) I lost background transparency. My tiles appear with a white 
background, I tried to change IMAGECOLOR from 255 255 255 to -1 -1 -1, 
also to remove this element but it doesn't change anything.
2) Fonts and symbols looks very crappy, they are mixed black and white 
where they should be filled with black with a white outline.

On a random tile, the image size fall from 102KB down to 25KB. Such 
ratio is not representative at all since it's not an average and it's 
only about vector data but still, quantize option seems very interesting 
and I don't want to give up because of transparency problems.

Trying to solve the first problem, I found a workaround for the second. 
When I set the TRANSPARENT parameter of the WMS request to 'false' (or 
any value different of 'true'), then fonts and symbols are displayed 
normally. It could have been ok if TRANSPARENT was not an optional 
parameter... The map should looks good in the default case.

Does someone could give more explanation about the quantize option, 
especially regarding transparency management ?

If possible, a broader answer about the FORMATOPTION element would help 
a lot. Indeed, it seems like most optimizations are possible through 
output format tuning. Unfortunately, I have not been able to find any 
reference document on this...

Regards,

-- 
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75011 PARIS
http://www.makina-corpus.com



More information about the mapserver-users mailing list