[gdal-dev] How gdal_translate scale the value, like from a larger range to a smaller range?

shark shark zhangyijunmetro at hotmail.com
Tue Dec 3 18:46:26 PST 2024


Hi guys. Have a nice day.

I’m curious how gdal scales the values when converting from a larger range to a smaller range,like from u32 to u8, u16 to u8, f32 to u8 etc..
I made a test:
gdal_translate -ot Byte -of GTiff  gray_u32.tif gray_u8.tif
All the u32 value in every sample of my gray_u32.tif is 10050
And All the value in result file is 255.
This seems to be a boundary case where the maximum and minimum values are both 10050 but I’m curious the behavior here and I didn’t find a doc about this.

I hope this question is not too suptid or weired.

Best, Lucas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20241204/5ea090cd/attachment.htm>


More information about the gdal-dev mailing list