[mapserver-users] CLASS directive

Matt Bartolome mattxbart at gmail.com
Tue Apr 26 12:57:48 EDT 2011


Hello,
I have a funky raster I'm trying to tile as jpegs. For whatever reason this
RGB raster has white pixels on the source raster which should be black. Is
it possible to set only these white pixels to be black on the output jpeg? I
was playing around with the CLASS directive. This sets all those white
pixels to black, but it does not preserve the rest of the rgb that I want to
use; those "good" values are not processed and show as blank (white) space.
How do I do this? I thought of preprocessing this with gdalwarp but the
raster becomes too large (source is an ecw) on output so need to do it
on-the-fly with mapserver (I'm using mapserver trunk and gdal 1.8 on linux).

Thanks!
Matt

OUTPUTFORMAT
    NAME jpeg
    DRIVER "AGG/JPEG"
    MIMETYPE "image/jpeg"
    IMAGEMODE RGB
    EXTENSION "jpg"
END

LAYER
  NAME "test"
  TYPE RASTER
  STATUS ON
  DATA "/test.tif"

  PROJECTION
    "init=epsg:2230"
  END

  PROCESSING "NODATA=255"

  CLASS
    NAME "set white to black"
    EXPRESSION ([red] = 255 AND [green] = 255 AND [blue] = 255)
    STYLE
    COLOR 0 0 0
  END

END
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110426/d40ec208/attachment.html


More information about the mapserver-users mailing list