[mapserver-users] mapserver vs mapscript: agg + transparency + quantize not working

Tiemens, Gerben Gerben.Tiemens at grontmij.nl
Thu Nov 5 09:04:55 PST 2009


I am busy writing a application with mapscript in C#.

Currently I am facing the earlier mentioned problems of agg + transparent images + quantization.

Is the new MS4W compiled with the quantization options?

The image background is now Black. The labels are dissapearing.

It should be an image wich is completly transparent with some colored lines and some black labels.

Setting the imagecolor will not help me.

Images without quantization options on, are perfect and beautiful png's.



What I am using now is this:

MS4W 3.0 Beta 7   which contains Mapserver 5.4.2



C# mapscript



Mapfile is completely written in C#, so all default options apply.

I saved this mapfile from my mapobj



----------------------

MAP

EXTENT 104952 495303 105452 495803

IMAGECOLOR 255 255 255

IMAGETYPE gif

SIZE 2000 2000

STATUS ON

UNITS METERS

NAME "MS"

OUTPUTFORMAT

NAME "PNG_mapscript"

MIMETYPE "image/png; mode=24bit"

DRIVER "AGG/PNG"

EXTENSION "PNG"

IMAGEMODE "RGBA"

TRANSPARENT TRUE

FORMATOPTION "QUANTIZE_FORCE=on"

FORMATOPTION "QUANTIZE_DITHER=off"

FORMATOPTION "QUANTIZE_COLORS=256"

END

SYMBOL

NAME "circle"

TYPE ELLIPSE

FILLED TRUE

POINTS

1 1

END

END

--

*snip*

--

END



----------------------------------------



In addition to above: further testing revealed that the transparent color is always black.



So if I set

imagecolor 99 99 99

transparent = true

And outputformat to:

OUTPUTFORMAT

NAME "PNG_mapscript"

MIMETYPE "image/png"

DRIVER "GD/PNG"

EXTENSION "PNG"

IMAGEMODE "RGBA"

TRANSPARENT TRUE

FORMATOPTION "QUANTIZE_FORCE=on"

FORMATOPTION "QUANTIZE_COLORS=256"

FORMATOPTION "QUANTIZE_NEW=on"

END

The image appears grey.

The black labels with white backgroundcolor and black shadowcolor in original image are mapped to: white background with gray outline characters and transparent filling and the shadow is grayoutlined with transparent filling. Probably the antialiasing generates the grey outline, the black filling is converted to transparent.

Something is going wrong.



If I set output format to:

OUTPUTFORMAT

NAME "PNG_mapscript"

MIMETYPE "image/png; mode=24bit"

DRIVER "AGG/PNG"

EXTENSION "PNG"

IMAGEMODE "RGBA"

TRANSPARENT TRUE

FORMATOPTION "QUANTIZE_FORCE=on"

FORMATOPTION "QUANTIZE_DITHER=off"

FORMATOPTION "QUANTIZE_COLORS=256"

END

The same applies for the text/labels, but background of the image is now black in all circumstances (no matter what color of imagecolor setting.



---------------------------------------------------



Further research drills down to where the problem may occur:

If i test my saved mapfile from mapscript into the apache/cgi-bin/mapserv.exe

The image is coming out as it should be.

Transparent background, features like it should be, and text also as it should be.,  but if I use the draw() method from mapscript, it comes out crippled.





Am i doing something wrong in mapscript? Are there configurations that I may miss in mapscript that are default in mapserv.exe?

I also do'nt know if this is a problem of Mapserver or MS4W, therefore crossposting it.

Greetings

Gerben



<< Please read our E-mail Disclaimer at: Emaildisclaimer.Grontmij.com >>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20091105/8e269b24/attachment.htm>


More information about the MapServer-users mailing list