[gdal-dev] gdal_translate -scale and negative values

Hermann Peifer peifer at gmx.eu
Mon Feb 15 14:02:38 EST 2010


Hi,

I am trying to scale the values in an Int16 raster band. Basically, I want to have them divided by 100. It looks to me that negative values are not scaled at all, whatever ranges I give to -scale. What am I doing wrong? 

Hermann 

$ gdalinfo -mm infile.tif
...
Band 1 Block=7200x1 Type=Int16, ColorInterp=Gray
    Computed Min/Max=-464.000,3122.000
  NoData Value=-32768
...

$ gdal_translate infile.tif outfile.tif -scale -500 0 -5 0
Input file size is 7200, 3600
0...10...20...30...40...50...60...70...80...90...100 - done.

$ gdalinfo -mm outfile.tif
...
Band 1 Block=7200x1 Type=Int16, ColorInterp=Gray
    Computed Min/Max=-328.000,31.000
  NoData Value=-32768
...

$ gdalinfo --version
GDAL 1.7.1, released 2010/02/08



More information about the gdal-dev mailing list