[gdal-dev] VRT image definition and LUT stretch

Armin Burger armin.burger at gmx.net
Sun Apr 20 17:03:32 EDT 2008


Tamas

thanks a lot for the quick help. The first option was the one I had 
tried before and it had no effect (so I thought the range definition has 
probably to be different). But the second option using ScaleRatio/Offset 
works well.

Armin

On 20/04/2008 22:45, Tamas Szekeres wrote:
> Armin,
> 
> As far as I know mapserver transforms the scale min/max values to the
> 0-255 range of the values. So by using the VRT ComplexSource the
> following 2 options can possibly be used:
> 
> Option 1:
> 
>   <VRTRasterBand dataType="Byte" band="1">
>     <ColorInterp>Red</ColorInterp>
>     <ComplexSource>
>       <LUT>117:0,339:255</LUT>
>       <SourceFilename>src.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>     </ComplexSource>
>   </VRTRasterBand>
> 
> Option 2:
> 
> <VRTRasterBand dataType="Byte" band="1">
>     <ColorInterp>Red</ColorInterp>
>     <ComplexSource>
>       <ScaleOffset>-134.919</ScaleOffset>
>       <ScaleRatio>1.153</ScaleRatio>
>       <SourceFilename>src.tif</SourceFilename>
>       <SourceBand>1</SourceBand>
>     </ComplexSource>
>   </VRTRasterBand>
> 
> Where:
> 
> ScaleRatio = 256/(scaleMax-scaleMin)
> ScaleOffset = -ScaleRatio*scaleMin
> 
> Best regards,
> 
> Tamas
> 
> 
> 
> 2008/4/20, Armin Burger <armin.burger at gmx.net>:
>> Hello
>>  Mapserver has the nice functionality for a histogram stretch of images
>> using the tag PROCESSING "SCALE=x,y". I would like know to predefine TIFF
>> images as a Virtual Format (VRT) and define the parameters for the linear
>> stretch in the VRT file instead of the layer definition via PROCESSING
>> SCALE=...
>>
>>  Is this possible? There is the <LUT> tag but I have not understood how to
>> convert from the PROCESSING definition to the required values there. What
>> would I need for example in the LUT that corresponds to
>>   PROCESSING "SCALE_1=117,339"
>>  for an image of type UInt16?
>>
>>  Thanks for any help
>>
>>  Armin
>>  _______________________________________________
>>  gdal-dev mailing list
>>  gdal-dev at lists.osgeo.org
>>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
> 


More information about the gdal-dev mailing list