[gdal-dev] How to add alpha channel to tiff image - C++ code
mighty_duck
msiljegovic at gmail.com
Wed Oct 3 13:11:43 PDT 2012
Hi Even,
thanks for your quick reply and explanation. I would kindly ask you for more
help, since I'm just trying to adapt this code quickly while still learning
all those concepts...
If I understood you well, those are changes:
hDstDS = GDALCreate(driver, output.c_str(), resX, resY,
4, GDALGetRasterDataType(GDALGetRasterBand(hSrcDS,
1)),
compressOption);
for (int i = 0; i < GDALGetRasterCount(hSrcDS); ++i)
{
GDALRasterBandH hSrcBand = GDALGetRasterBand(hSrcDS, i + 1);
GDALRasterBandH hDstBand = GDALGetRasterBand(hDstDS, i + 1);
GDALColorTableH cTable = GDALGetRasterColorTable(hSrcBand);
GDALSetRasterColorInterpretation(hDstBand,
GDALGetRasterColorInterpretation(hSrcBand));
if (cTable)
{
GDALSetRasterColorTable(hDstBand, cTable);
}
//remove code below????
int success;
double noData = GDALGetRasterNoDataValue(hSrcBand, &success);
if (success)
{
GDALSetRasterNoDataValue(hDstBand, noData);
}
else if (zeroAsTransparent)
{
GDALSetRasterNoDataValue(hDstBand, 0);
}
}
//edit only alpha channel here...if so what do you mean by that, what
methods to use??
Thanks for understanding.
--
View this message in context: http://osgeo-org.1560.n6.nabble.com/How-to-add-alpha-channel-to-tiff-image-C-code-tp5006218p5006225.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list