I am trying to convert a uint16 geotiff image with 4 bands (RGB&NIR) with LZW compression to a uint8 geotiff image with 3 bands (RGB) without compression. Here is what I have tried:

gdal_translate -ot Byte -b 1 -b 2 -b 3 -r cubic "20170729_182758_0f28_3B_AnalyticMS_SR.tif" "output.tif"

When I drag and drop the image in QGIS, I get meaningful colours. When I generate a tif file using the above command, the colours are off (looks washed out). Any ideas what might be the problem?

  • QGIS is using a contrast stretch. gis.stackexchange.com/a/284351/2856 – user2856 Oct 3 '19 at 5:17
  • 1
    Thanks! gdal_translate -ot Byte -b 1 -b 2 -b 3 -scale_1 98 854 -scale_2 196 1028 -scale_3 182 1102 -r cubic "20170729_182758_0f28_3B_AnalyticMS_SR.tif" "output.tif" – bluetooth12 Oct 3 '19 at 5:58

Your Answer

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

Browse other questions tagged or ask your own question.