I am trying to run a GDAL command that converts the bit depth while applying a stretch function (gdal_contrast_stretch -ndv 0 -linear-stretch 70 30 ./tmp/b2-projected.tif ./tmp/b2-8bit.tif). However, I can't find a way to do it in MS Windows. I have checked the precompiled GDAL binaries in GISinternals and they don't carry the above mentioned command. If not available, what do you guys suggest to use to get the same output using CLI tools in Windows?
-
1gdal_contrast_stretch isn't a part of GDAL, but rather is a utility for use in conjunction with GDAL; which is why I assume it's not available with the precompiled GDAL available at GISinternals.– nmtokenCommented Dec 14, 2016 at 20:10
-
2It's here in Github.Unfortunately there isn't a makefile available for Windows.– Steven KayCommented Dec 14, 2016 at 20:15
Add a comment
|
1 Answer
I believe you can get a similar result using gdal_translate and the -scale option.
-scale [src_min src_max [dst_min dst_max]]:
Something like the following (also specifying the output type if you want it to differ from the input type):
gdal_translate -scale 0 12000 -ot byte ./tmp/b2-projected.tif ./tmp/b2-8bit.tif
You will need to determine the appropriate values of source min & source max based on your input image.