[gdal-dev] gdal_translate -scale
Rahkonen Jukka (MML)
jukka.rahkonen at maanmittauslaitos.fi
Mon Dec 14 04:38:07 PST 2020
Hi,
Please remember to use reply-to-all for sending a copy to the list as well.
-Jukka-
-----Alkuperäinen viesti-----
Lähettäjä: jesus.moran at solute.es <jesus.moran at solute.es>
Lähetetty: maanantai 14. joulukuuta 2020 14.27
Vastaanottaja: Rahkonen Jukka (MML) <jukka.rahkonen at maanmittauslaitos.fi>
Aihe: RE: [gdal-dev] gdal_translate -scale
Hi,
Thank you so much for your quick response. I can see the issue here. My data is 16 bits so it can be omitted in the -scale param. I will have to look for Python aid as you said, then.
Have a nice Monday!
Jesús Maria Morán Rosado
Project Engineer
Av. Cerro del Águila, 3, 28703 S.S. de los Reyes, Madrid
CONFIDENTIALITY: This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.
-----Original Message-----
From: gdal-dev <gdal-dev-bounces at lists.osgeo.org> On Behalf Of jratike80
Sent: lunes, 14 de diciembre de 2020 13:18
To: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] gdal_translate -scale
Hi,
If your output is 8 bit you can just use -scale without min/max values.
From https://gdal.org/programs/gdal_translate.html:
"Rescale the input pixels values from the range src_min to src_max to the range dst_min to dst_max. If omitted the output range is 0 to 255. If omitted the input range is automatically computed from the source data."
If your data is higher than 8 bit and you want to keep it so you are out of luck with gdal_translate because it first omits the output range and sets it into 0-255 before it can omit the input range and compute the range automatically.
The current behavior is not optimal for certain use cases (https://gis.stackexchange.com/questions/294129/min-max-stretch-using-gdal-translate-in-a-batch).
Some programmer learning GDAL could take this as a challenge and formulate how to improve the automatic scaling support so that it would not break too much. As a first aid a Python script for automatic min/max scaling would be nice, and why not with an option to utilize the histogram and use for example +/- 98% of the histogram. Or mean +/- (2 x RMS).
-Jukka Rahkonen-
jesus.moran wrote
> Hello GDAL team and thank you for welcome me.
>
>
>
> I have an issue with the gdal_translate command. I would like to use
> the “STATISTICS_MIN” and “STATISTICS_MAX” metadata key values in the
> -scale parameter of the program, so I don’t need to specify it
> manually every time I want to scale the output. Is there any way to do
> this?
>
>
>
> Thanks a lot in advance!
>
>
>
>
> <http://www.solute.es/>
>
>
> Jesús Maria Morán Rosado
> Project Engineer
>
> Av. Cerro del Águila, 3, 28703 S.S. de los Reyes, Madrid
>
> CONFIDENTIALITY: This e-mail and any attachments are confidential and
> may be privileged. If you are not a named recipient, please notify the
> sender immediately and do not disclose the contents to another person,
> use it for any purpose or store or copy the information in any medium.
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at .osgeo
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> image001.gif (2K)
> <http://osgeo-org.1560.x6.nabble.com/attachment/5452429/0/image001.
> gif>
--
Sent from: http://osgeo-org.1560.x6.nabble.com/GDAL-Dev-f3742093.html
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev
More information about the gdal-dev
mailing list