[gdal-dev] Alpha band masking

Even Rouault even.rouault at spatialys.com
Sat Nov 14 11:00:45 PST 2015


Le samedi 14 novembre 2015 19:49:02, ozdogan at wisc.edu a écrit :
> Dear All
> I have a 4-band air photo image in which the 4th band is the NIR band but
> it has also been designated as an alpha band. It is the geotiff format.
> For some reason whenever I reproject this file (using gdalwarp) or resize
> it (using gdal_translate) all four bands of the resulting files have zero
> values. It is as if the alpha band is being used to mask all band values. 
> Any help reprojecting or windowing this large file without making while
> retaining all 4 band values would be much appreciated. Thank you

Mutlu,

The issue is probably indeed the NIR band being recognized as an alpha band. 
You can remove the alpha interpretation with :

gdal_translate in.tif tmp.tif -co alpha=no
rm tmp.tif.aux.xml (or del tmp.tif.aux.xml on Windows)

The removal of tmp.tif.aux.xml is important otherwise the alpha interpretation 
would be kept in this XML file

And then you can gdalwarp this tmp.file with the arguments you need :

gdalwarp tmp.tif ...

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list