[mapserver-users] set COLOR to transparent?

Roger André randre at gmail.com
Sun May 2 13:05:39 EDT 2010


Hi Wendell,

Sorry for all the questions in response.  Do you want to set all RGB color
values greater than 200 to transparent?  You mention a "color table", are
you using a paletted image?  Also, out of curiosity, do the > 200 areas
already appear transparent when you view the image in a graphics editor?

For RGB images with single color values that are the background color of the
image, you can use IMAGECOLR to set that color transparent.  You can also
pre-process the image with GDAL and assign that pixel value as NODATA, which
MapServer will respect when it renders it.  For raster data that is not RGB,
you can set multiple STYLES that evaluate pixel values and render them in a
specific color, essentially defining a LUT in the MAPFILE.  In that case,
the omission of a pixel value will cause those areas not to be displayed.  I
have not tried that with an RGB image though.

The technique I have found that works well for setting a range of values to
be transparent is to use ImageMagick's "-transparent" command in conjunction
with "-fuzz".  Here is an example of that:

convert small_vis.tif -fuzz 25% -transparent "rgb(0,0,0)" alpha_test10.gif

Roger
--

On Fri, Apr 30, 2010 at 2:34 PM, Wendell Turner <wendell at enflight.com>wrote:

> Is there a way to turn a pixel transparent?  That is,
> something like:
>
>  CLASS
>  EXPRESSION ([red] > 200 AND [green] > 200 AND [blue] > 200 )
>  TRANSPARENT
>  END
>
> Or is there a way to set the pixel to the index of the
> transparent entry in the color table?
>
> Also, is there an 'ELSE' clause to the class/expression
> statements?  That is, if the expression fails, leave other
> pixels alone.  Using a class and an expression seems to
> reset all other pixels.
>
> Thanks,
>
> Wendell
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20100502/c1d5570c/attachment.html


More information about the mapserver-users mailing list