[mapserver-users] transparent pixmaps in python mapscripts

Fawcett, David David.Fawcett at state.mn.us
Wed Sep 24 01:09:05 EDT 2008


I am using a pixmap symbol to mark a point using Python MapScript v.
5.2.  
 
The image has a transparent background.  When I use the symbol with
MapServer CGI, I the transparency works.  When I use the symbol in
MapScript, I get a black background for the symbol, no transparency.  
 
Here is how I am creating the symbol:
 
img = mapscript.imageObj(/symbols/redcross.png', 'GD/PNG')
 
# create the symbol using the image
symbol = mapscript.symbolObj('from_img')
symbol.type = mapscript.MS_SYMBOL_PIXMAP
symbol.setImage(img) 
symbol_index = mymap.symbolset.appendSymbol(symbol)  
 
I also tried to add this to the layer, but it made no difference either:
inline_layer.transparency = mapscript.MS_GD_ALPHA
 
Here is a gdalinfo report on the symbol image:
 
Driver: PNG/Portable Network Graphics
Files: redcross.png
Size is 32, 32
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   32.0)
Upper Right (   32.0,    0.0)
Lower Right (   32.0,   32.0)
Center      (   16.0,   16.0)
Band 1 Block=32x1 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=32x1 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=32x1 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=32x1 Type=Byte, ColorInterp=Alpha

 
Any ideas on how to get a pixmap symbol with a transparent background
using python mapscript?  
 
Thanks, 
 
David.
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080924/294e1a9a/attachment.html


More information about the mapserver-users mailing list