[mapserver-users] Using IMAGECOLOR to create a transparency mask

Stephen Woodbridge woodbri at swoodbridge.com
Wed Feb 4 22:57:38 EST 2009


gwaldron wrote:
> I'm trying to use IMAGECOLOR to try to force all pixels of a certain color to
> become fully transparent, but I am not having any luck getting it to work.
> 
> My output format it AGG/PNG, RGBA, TRANSPARENT ON.
> 
> I have a shapefile layer set to COLOR 0 50 100, and my map-level IMAGECOLOR
> set to the same. I was hoping all the polys in the shapefile would render as
> transparent pixels, but no luck; they just show up as blue polygons.
> 
> What am I doing wrong here? Thanks.

Transparency is tricky indeed. I always have to experiment with setting 
to get it to work. I should document it for my one good, next time I 
work it out. Which doesn't really help you, but you might try the following.

COLOR -1 -1 -1

or leaving the COLOR off totally on a polygon should prevent it from 
filling, You probably want to use OUTLINECOLOR to cause it to draw the 
polygon border.

Or are you trying to draw a color the will overwrite the pixels below it 
and make them transparent?

-Steve W


More information about the mapserver-users mailing list