2

I am using GDAL translate to convert tif in float 32 to Byte format. When I run the conversion using GDAL translate, the output is useless (see pictures). GDAL does not seem to have this problem with other formats, Int 16 worked fine, but I need these images in Byte.output input

Command: gdal_translate -ot Byte -of GTiff "D:/QGIS ASTER TEST/Singleband/StAustell/RT_StAustell_14.tif" "D:/QGIS ASTER TEST/test4.tif"

Log: Processing algorithm… AlgorithmDialog Input parameters: { 'COPY_SUBDATASETS' : False, 'DATA_TYPE' : 0, 'INPUT' : 'D:/QGIS ASTER TEST/Singleband/StAustell/RT_StAustell_14.tif', 'NODATA' : 0, 'OPTIONS' : '', 'OUTPUT' : 'D:/QGIS ASTER TEST/test4.tif', 'TARGET_CRS' : '' }

GDAL command: gdal_translate -ot Byte -of GTiff "D:/QGIS ASTER TEST/Singleband/StAustell/RT_StAustell_14.tif" "D:/QGIS ASTER TEST/test4.tif" GDAL command output: Input file size is 969, 872

0...10...20...30...40...50...60...70...80...90...100 - done.

Execution completed in 0.12 seconds Results: {'OUTPUT': }

Loading resulting layers Algorithm 'Translate (convert format)' finished

Geodatsci
  • 123
  • 9
  • 2
    Post the command you have been using so we can further help you. – RomaH May 17 '18 at 14:04
  • I am using the GDAL extension in QGIS – Geodatsci May 17 '18 at 14:20
  • 1
    At the bottom of the translate window there should be a text box that has a string of text starts 'gdal_translate', with name of files and options, that is the command that was ran. Post that text here so we can review your command, and see if there is a bug/error/etc. – RomaH May 17 '18 at 14:38
  • I have added the command and log as an edit. – Geodatsci May 17 '18 at 14:45
  • how do you know for sure that the output is "useless", have you tried other visualization options and inspect some sample pixels? – RutgerH May 17 '18 at 16:12
  • Yeah I was testing some stuff and I think it is probably you just haven't clamped the contrast after the conversion of the tiff. Under Layer Properties>Style>Band Rendering>Contrast Enhancement: Set that value from 'No enhancement' to 'Stretch Min/Max' – RomaH May 17 '18 at 16:29
  • I have inspected some sample pixels and each pixel within the white square has a value of 255 and each pixel outside has a value of 0. I also tried some different contrast enhancement options and it did make any difference. – Geodatsci May 17 '18 at 16:33
  • 1
    You probably haven't scaled your data, please edit your question and post the orig. raster statistics (min, max) and no data values. Byte can only store values 0-255. – user2856 May 17 '18 at 23:18
  • 1
    I hade the exact same problem and as Luke writes missing scaling was the issue – lijat Nov 02 '18 at 11:06

0 Answers0