[gdal-dev] GeoTiff and the 4th band
Even Rouault
even.rouault at mines-paris.org
Mon Apr 18 04:56:51 EDT 2011
Selon Nicolas Mayer <nmayer31000 at gmail.com>:
Retry by setting the PHOTOMETRIC creation option to MINISBLACK. Otherwise, by
default, without specifying it, GDAL assumes that the PHOTOMETRIC is RGB and
that the 4th band is an alpha band.
You should get :
Band 1 Block=100x20 Type=Byte, ColorInterp=Gray
Band 2 Block=100x20 Type=Byte, ColorInterp=Undefined
Band 3 Block=100x20 Type=Byte, ColorInterp=Undefined
Band 4 Block=100x20 Type=Byte, ColorInterp=Undefined
There's no way in the TIFF format to really specify the color interpretation of
each band. The way GDAL builds the color interpretation when reading a TIFF file
is a combination of the value of the PHOTOMETRIC and EXTRASAMPLES tag.
> Hello
>
> I have a problem with the geotiff (GTiff) driver.
>
> I create a 4-bands raster image in a c++ program. The fourth band was
> considered as an alpha band in the geotiff image (actually, it is near
> infrared : NIR)
>
> $ gdalinfo new_geotiff.tif
> Driver: GTiff/GeoTIFF
> Files: new__geotiff.tif
> Size is 100, 100
> (...)
> Band 1 Block=100x20 Type=Byte, ColorInterp=Red
> Mask Flags: PER_DATASET ALPHA
> Band 2 Block=100x20 Type=Byte, ColorInterp=Green
> Mask Flags: PER_DATASET ALPHA
> Band 3 Block=100x20 Type=Byte, ColorInterp=Blue
> Mask Flags: PER_DATASET ALPHA
> Band 4 Block=100x20 Type=Byte, ColorInterp=Alpha
>
> How to remove the Color interpretation 'alpha' and the mask flags ?
>
> I want to have :
>
> Band 1 Block=100x20 Type=Byte, ColorInterp=Red
> Band 2 Block=100x20 Type=Byte, ColorInterp=Green
> Band 3 Block=100x20 Type=Byte, ColorInterp=Blue
> Band 4 Block=100x20 Type=Byte, ColorInterp=Undefined
>
> I already tryed :
> pDS->GetRasterBand(4)->SetColorInterpretation(GCI_Undefined );
>
> I tryed too to set the creation option : "ALPHA" to "NO".
>
>
> Thanks in advance for any help.
>
> Nicky
>
More information about the gdal-dev
mailing list