Hello! I've been trying to figure this out for a while and this would be my first time asking a question here.
How do I load a 3-band tiff into a virtual dataset, add a band (alpha layer), warp the virtual dataset, then write it out to a TIFF again (different, path, different name)? I'm loading a 3-band tiff into a virtual dataset using C# and then attempting to add an alpha layer using this code: // Load image dataset using (OSGeo.GDAL.Dataset imageDs = OSGeo.GDAL.Gdal.Open(devPath, OSGeo.GDAL.Access.GA_ReadOnly)) { // Copy dataset data into a virtual dataset virtDs = OSGeo.GDAL.Gdal.GetDriverByName("VRT").CreateCopy("", imageDs, 0, null, null, null); // If addAlpha true, add an alpha layer band if (addAlpha) { virtDs.AddBand(OSGeo.GDAL.DataType.GDT_Byte, null); virtDs.GetRasterBand(4).SetColorInterpretation(OSGeo.GDAL.ColorInterp.GCI_AlphaBand); } imageDs.Dispose(); GC.Collect(); } I then attempt to warp the virtual dataset and write it back out to a TIFF again (with the option "ALPHA=YES"). I feel like I'm missing something and I'm not sure what. Every time I attempt to view the new TIFF, it ends up transparent. The only way I seem to get it to work in a viewable manner is to manually copy each raster band to a new dataset and filling in the alpha band (band 4) with 255. Any help is appreciated, thanks in advance! -Alex -- View this message in context: http://osgeo-org.1560.n6.nabble.com/gdal-dev-Adding-an-alpha-channel-to-a-Virtual-Dataset-then-Writing-it-out-to-a-TIFF-in-C-tp4977895.html Sent from the GDAL - Dev mailing list archive at Nabble.com. _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev