I read my hyperspectral (.raw) file and combine three bands to "gai_out_r" Then I output as following:
writeRaster(gai_out_r,filepath,format="GTiff")
finally I got gai_out_r.tif
But, why Win10 can't display this small tif as the pic that I output the same way from envi--save image as--tif
Two tiffs are displayed by Win10 as following:
Cause of the issue:
I had a similar issue and recognised that the exported .tif files had a different bit depth than .tif images I could open. The images could not be displayed using common applications, although they were not broken and I could open them in R or QGIS. Hence, the values were coded in a way Windows would not expect.
When you type
?writeRaster()
you will find that there are various options when it comes to saving a .tif (or other format) using theraster::writeRaster()
function. Click on the links therein to get to thedataType {raster}
help site and you'll find there are various integer types to choose from.Solution (write a Windows-readable GeoTIFF):
I set the following options to make the resulting .tif file readable (note the
datatype
option):Note: I realised your post is from 2 and a half years ago... Anyways, may this answer help others who encounter this problem.