AGG, paletted image and transparency (Mapserver 5.0 beta 5)
Steve Lime
Steve.Lime at DNR.STATE.MN.US
Thu Aug 30 11:52:22 PDT 2007
Just for clarification, you expect then that pixels with the color
IMAGECOLOR would be transparent
correct? Since you're doing pure vector rendering the alpha channel
really isn't necessary. Only rasters
processed through GDAL actually write to the alpha channel with values
other than fully opaque or fully
transparent. Any opacity settings in layers affect blending and don't
change the alpha channel.
Seems like this should be an RGB image with the color closest to
IMAGECOLOR marked as transparent
in the resulting palette. Just thinking out loud on how to fix...
Steve
>>> On 8/30/2007 at 12:35 PM, in message
<46D6FFF9.4020109 at makina-corpus.com>,
Gilles Bassière <gilles.bassiere at MAKINA-CORPUS.COM> wrote:
> 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
>>
>> tb
>>
> Ok, thanks.
> 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.
>
> Regards,
> Gilles
>> 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:
>>>
>>> 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