AGG, paletted image and transparency (Mapserver 5.0 beta 5)
gilles.bassiere at MAKINA-CORPUS.COM
Thu Aug 30 13:35:53 EDT 2007
thomas bonfort wrote:
> quantization does not seem to support transparent backgrounds
> (regardless of gd or agg)
> I'll file a bug about this but I don't know if it will be fixed for 5.0
I tried several value for IMAGECOLOR but I didn't get any results.
Would be great to solve this bug soon because AGG tends to produce heavy
images. In most vector data based map 256 colors are enough, thus this
quantize option would be an interesting solution.
> On 8/30/07, Gilles Bassière <gilles.bassiere at makina-corpus.com> wrote:
>> 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:
>> 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"
>> 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...
>> Gilles Bassiere
>> MAKINA CORPUS
>> 30 rue des Jeuneurs
>> FR-75011 PARIS
30 rue des Jeuneurs
More information about the mapserver-users