Transparent Pixmap Background in MapScript
Sean Gillies
sgillies at FRII.COM
Mon Nov 21 21:11:51 PST 2005
On Nov 21, 2005, at 7:53 PM, Fawcett, David wrote:
> I know that I have seen the proper code before, but my search hasn't =
> been able to relocate it. =20
>
> In python mapscript, I am creating a pixmap symbol from a gif. I am =
> building everything without a map file. Everything works, but I
> end up =
> getting a black background on my transparent gif symbol. =20
>
> I am pretty sure that I need to set a color or background color, but =
> can't get it quite right. =20
>
> Here is what I am trying:=20
>
> # add the image symbol we defined above to the inline layer
> cls =3D mapscript.classObj(inline_layer)
> cls.name=3D'classname'
> style =3D mapscript.styleObj(cls)
> style.symbol =3D mymap.symbolset.index('from_img')
> style.backgroundcolor.setRGB(-1, -1, -1)
> style.color.setRGB(-1, -1, -1)
>
>
> Thanks,=20
>
> David.
If your GIF is properly transparent, all you have to do is set the
transparency property of your layer
layer.transparency = mapscript.MS_GD_ALPHA
cheers,
Sean
---
Sean Gillies
sgillies at frii dot com
http://zcologia.com/news
More information about the MapServer-users
mailing list