[gdal-dev] -scale default

Michael Sumner mdsumner at gmail.com
Thu Sep 7 19:20:43 PDT 2023


Hi, I'm expecting `gdal_translate -scale` to emit values in the range 0,255
but it seems to be targeting 0,256.  (All works as expected when using
explicit src_min src_max dst_min dst_max).

To see the output range on a simple example (see code at link below in case
email garbles):

from osgeo import gdal
ds = gdal.Translate("/vsimem/scl.tif", "autotest/gcore/data/float32.tif",
options = "-scale")
ds.GetRasterBand(1).ComputeRasterMinMax()
## (0.0, 255.99899291992188)

Is that expected, am I missing something? I've tried variations on the
input values and output types.

https://gist.github.com/mdsumner/ee4103d8616b9aa341e82c46b44a8c8c

Cheers, Mike


-- 
Michael Sumner
Research Software Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230908/9e09e306/attachment.htm>


More information about the gdal-dev mailing list