6

Everytime with every function (e.g convert data storage type or gdal-translat -ot Byte) the output is a completely white map with a black border. only the "save as" export works, but the TIFF also has 3 bands and the data is much bigger..this isnt my intention

Has anybody an idea?

11
  • 1
    Show gdalinfo -stats reports from the original and converted. Put a sample image to play with somewhere for downloading if you have right to do it.
    – user30184
    Sep 17, 2014 at 14:28
  • what is the range of your input values ?
    – radouxju
    Sep 17, 2014 at 14:30
  • value range of the input scene is 0 - 25480.812476 value range of the wrong created 8 bit is 0 - 255 enclosed u will find a link which contais the 16 bit single-band (free content): file-upload.net/download-9541350/…
    – Thelema
    Sep 17, 2014 at 19:37
  • Try adding -scale src_min src_max in gdal_translate code. src_min and src_max values based on yours 16bit raster value range will be needed to scale down to 8bit (see detailed description: gdal.org/gdal_translate.html)
    – jzol
    Sep 17, 2014 at 20:10
  • ive tried this and fortunatly the output has had the correct value range 0-255 + -ot byte command i have now the result i wanted to have. thanks!
    – Thelema
    Sep 17, 2014 at 21:56

1 Answer 1

4

Lets have a close look at statistics about scene enclosed by you:

C:\Program Files\QGIS Chugiak\bin>gdalinfo C:\Users\Janek\Desktop\LC819402420142
48LGN00_B5.TIF -stats

[...]

  Metadata:
    STATISTICS_MAXIMUM=65535 - this especially!

    STATISTICS_MEAN=10396.365071613

    STATISTICS_MINIMUM=0 - and this one

    STATISTICS_STDDEV=7547.8323562457

... and histogram:

enter image description here

Having it's real values in much narrower range - to perform raster conversion you should force scaling in gdal_translate

Add -scale src_min src_max in gdal_translate code src_min and src_max values based on yours 16bit raster real value range, and -ot Byte to force 8bit value type. To omit no data areas add also a_nodata 0.

Try something like this:

enter image description here

2
  • What can be done if we have 3 bands with different min max values ?
    – addcolor
    Jul 26, 2023 at 4:32
  • 1
    You can alway process each band separately (for gdal_translate add flag -b to select given band e.g. -b 1) then you can merge bands back to a single raster (e.g. via vrt format or using gdalmerge)
    – jzol
    Aug 1, 2023 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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