<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body text="#1F497D" bgcolor="#FFFFFF">
    <font face="Calibri">Hi,<br>
      <br>
      Is there a way to use the PROCESSING "SCALE=AUTO" directive to get
      extent-based contrast stretching with custom colorranges? When I
      test my mapfile (relevant layer part below) with the Openlayers
      viewer it gets the desired color ramps but does not do contrast
      stretching for the current extent. If I take the CLASS'es out the
      greyscale output is contrast stretched according to current
      extent. I have tried taking out the EXPRESSIONS and/or the
      DATARANGES but then it only takes the first COLORRANGE and does
      not stretch it.<br>
      <br>
      Thanks,<br>
      Theo<br>
      <br>
      # raster layer<br>
      LAYER<br>
       NAME "mapservtest"<br>
       TYPE RASTER<br>
       PROCESSING "SCALE=AUTO"<br>
       STATUS ON<br>
       DEBUG ON<br>
       PROJECTION<br>
         "init=epsg:3857"<br>
       END<br>
       METADATA<br>
         #WMS stuff here<br>
       END<br>
       TILEITEM "location" #location is a column in postgis table with
      varchar of the filepath to each image<br>
       TILEINDEX "index"<br>
       FILTER (`[datetime]` = `2015-01-01T00:00:00Z`)<br>
       OFFSITE 0 0 0<br>
       CLASS<br>
        EXPRESSION ([pixel] >= 25 AND [pixel] < 30)<br>
        STYLE<br>
          COLORRANGE  "#00ff00"  "#0000ff"<br>
          DATARANGE 25 30<br>
        END # STYLE<br>
       END # CLASS<br>
       CLASS<br>
        EXPRESSION ([pixel] < 25)<br>
        STYLE<br>
          COLORRANGE  "#ff0000"  "#00ff00"<br>
          DATARANGE 20 25<br>
        END # STYLE<br>
       END # CLASS<br>
      END<br>
      <br>
      <br>
      <br>
    </font>
  </body>
</html>