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?

  • 1
    gdal_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.
    – nmtoken
    Dec 14, 2016 at 20:10
  • 2
    It's here in Github.Unfortunately there isn't a makefile available for Windows.
    – Steven Kay
    Dec 14, 2016 at 20:15

1 Answer 1


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.

gdal_translate Documentation

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.