From 383ff0638532e5392bd998b026b2c34d64856074 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Thu, 5 Dec 2019 20:56:46 +0000 Subject: [PATCH] Fixed alpha band for 16bit datasets Former-commit-id: e39f3a68353635641c1d6d0ca7cff05809225290 --- modules/odm_orthophoto/src/OdmOrthoPhoto.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/odm_orthophoto/src/OdmOrthoPhoto.cpp b/modules/odm_orthophoto/src/OdmOrthoPhoto.cpp index 8cd892ab..5f206286 100644 --- a/modules/odm_orthophoto/src/OdmOrthoPhoto.cpp +++ b/modules/odm_orthophoto/src/OdmOrthoPhoto.cpp @@ -319,6 +319,10 @@ void OdmOrthoPhoto::saveTIFF(const std::string &filename, GDALDataType dataType) for (size_t i = 0; i < bands.size(); i++){ hBand = GDALGetRasterBand( hDstDS, static_cast(i) + 1 ); + + // Set alpha band + if (i == 3) GDALSetRasterColorInterpretation(hBand, GCI_AlphaBand ); + if (GDALRasterIO( hBand, GF_Write, 0, 0, width, height, bands[i], width, height, dataType, 0, 0 ) != CE_None){ std::cerr << "Cannot write TIFF to " << filename << std::endl;