[gdal-dev] -scale command

Frank Warmerdam warmerdam at pobox.com
Fri Apr 16 10:29:47 EDT 2010

hjp85 wrote:
> Hi,
> I have numerous velocity raster images from an ice sheet model that I would
> like to scale so that each raster has has a maximum value of 1000 and
> minimum value of 0. At the moment they all have different max values
> depending on what the fastest velocity of the ice sheet is at that moment in
> time.
> What i'm not sure on is how to construct the command. The example given is;
> -scale [src_min src_max [dst_min dst_max]]
> but how do you get the input range to be automatically computed (i.e.
> src_min and src_max), so that i don't have to look up each one in turn?
> -scale 0 1000 doesn't work for me...


Unfortunately due to the way the -scale commandline argument is
processed you cannot allow it to autoselect the input range and still
allow you to use a non default output range.

So either you need to just use -scale and let it rescale things to 0 to 255
(and then perhaps rescale again to 0 to 1000), or you could run gdalinfo
with the -mm (min max) switch to find the maximum value in advance.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list