AGG, paletted image and transparency (Mapserver 5.0 beta 5)
Gilles Bassière
gilles.bassiere at MAKINA-CORPUS.COM
Thu Aug 30 10:03:42 PDT 2007
thomas bonfort wrote:
> do you have an image or an url for the artifacts on the fonts and pixmaps?
>
Hi Thomas,
I'm not sure about what is pixmap... Is it a kind of symbol? Anyway, I
don't use it explicitly in my mapfile.
I made available online two sample images :
- http://sig.demo.makina-corpus.com/MS5.quantize.png
- http://sig.demo.makina-corpus.com/MS5.no_quantize.png
There is no data in the top left corner, thus this area should be
transparent but is not when quantize is on. I also realised something
new. The mixed white colour in labels is not white actually, it's
transparent (try to wiew it in a browser with a coloured background). I
checked with GIMP and found that only pure black pixels are transparent.
Due to antialiasing other pixels in the labels are dark gray. It seems
like, when quantize is on, a negation of the IMAGECOLOR value happen...
It looks like a bug, I'm gonna do some more tests.
Cheers,
Gilles
>
> On 8/30/07, Gilles Bassière <gilles.bassiere at makina-corpus.com> wrote:
>
>> Flavio Hendry wrote:
>>
>>> Hi Gilles
>>>
>>> Did you try TRANSPARENCY alpha (on LAYER level).
>>>
>>>
>> I did but it doesn't change anything. According to
>> http://mapserver.gis.umn.edu/docs/howto/agg-rendering-specifics :
>>
>> "All rendering is now done antialiased by default. All ANTIALIAS
>> keywords are now ignored, as well as TRANSPARENCY ALPHA. Pixmaps and
>> fonts are now all drawn respecting the image's internal alpha channel
>> (unless a backgroundcolor is specified)."
>>
>> Without the TRANSPARENCY ALPHA, I don't know how to get this "image's
>> internal alpha channel" to work as I want
>>
>> Regards,
>> Gilles
>>
>>
>>> Mit freundlichem Gruss / Best Regards
>>> Flavio Hendry
>>>
>>> ----------------------------------------------------------------
>>> TYDAC Web-Site: http://www.tydac.ch
>>> TYDAC MapServer: http://www.mapserver.ch
>>> ----------------------------------------------------------------
>>> ############ Mit freundlichen Gruessen / Kind Regards
>>> ############ mailto:flavio at tydac.ch
>>> ############ TYDAC AG - http://www.tydac.ch
>>> #### #### Geographic Information Solutions
>>> #### #### Luternauweg 12 -- CH-3006 Bern
>>> ############ Tel +41 (0)31 368 0180 - Fax +41 (0)31 368 1860
>>> ----------------------------------------------------------------
>>>
>>>
>>> -----Original Message-----
>>> From: Gilles Bassière <gilles.bassiere at MAKINA-CORPUS.COM>
>>> To: MAPSERVER-USERS at LISTS.UMN.EDU
>>> Date: Thu, 30 Aug 2007 16:44:41 +0200
>>> Subject: [UMN_MAPSERVER-USERS] AGG, paletted image and transparency
>>> (Mapserver 5.0 beta 5)
>>>
>>>
>>>
>>>> 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
>>>>
>>>>
>> --
>> Gilles Bassiere
>> MAKINA CORPUS
>> 30 rue des Jeuneurs
>> FR-75011 PARIS
>> http://www.makina-corpus.com
>>
>>
--
Gilles Bassiere
MAKINA CORPUS
30 rue des Jeuneurs
FR-75011 PARIS
http://www.makina-corpus.com
More information about the MapServer-users
mailing list