Perhaps this helps. Good luck. //Anders Söderman Sweden

 

http://www.gdal.org/frmt_gtiff.html 

 

Internal nodata masks (from GDAL 1.6.0) 

TIFF files can contain internal transparency masks. The GeoTIFF driver
recognizes an internal directory as being a transparency mask when the
FILETYPE_MASK bit value is set on the TIFFTAG_SUBFILETYPE tag. According to
the TIFF specification, such internal transparency masks contain 1 sample of
1-bit data. Although the TIFF specification allows for higher resolutions
for the internal transparency mask, the GeoTIFF driver only supports
internal transparency masks of the same dimensions as the main image.
Transparency masks of internal overviews are also supported

When the GDAL_TIFF_INTERNAL_MASK environment variable is set to YES and the
GeoTIFF file is opened in update mode, the CreateMaskBand() method on a TIFF
dataset or rasterband will create an internal transparency mask. Otherwise,
the default behaviour of nodata mask creation will be used, that is to say
the creation of a .msk file, as per RFC 15

  _____  

From: qgis-user-boun...@lists.osgeo.org
[mailto:qgis-user-boun...@lists.osgeo.org] On Behalf Of Pietro Panzeri
Sent: den 3 juni 2010 12:57
To: qgis-user@lists.osgeo.org
Subject: [Qgis-user] Re: Grayscale GeoTiff and transparency using GDAL.

 

No one has a solution?
Thank you.

On Mon, May 31, 2010 at 10:42 AM, Pietro Panzeri
<pietro.panz...@treuropa.com> wrote:

Hi all,

I'm writing a plugin using GDAL C library to allow the user to create a
grayscale GeoTiff with transparency.

I've used the following code to init the raster:

Driver = GDALGetDriverByName("GTiff");    

papszOptions = CSLSetNameValue(papszOptions, "COMPRESS", "LZW");

Dataset = GDALCreate(Driver, SrcFilename, XSize, YSize, 2, GDT_Byte,
papszOptions);

Band1 = GDALGetRasterBand(Dataset, 1);
GDALSetRasterColorInterpretation(Band1, GCI_GrayIndex);     

Band2 = GDALGetRasterBand(Dataset, 2);
GDALSetRasterColorInterpretation(Band2, GCI_AlphaBand);

...
Init the two bands
...


The result is a correct grayscale image but without transparency.

Can someone point me a way to create a grayscale GeoTiff with a
transparency?

Thank you very much.

Pietro


-- 
Pietro Panzeri

Software Development Manager

Tele-Rilevamento Europa - T.R.E. srl
Via Vittoria Colonna, 7
20149 Milano – Italia
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
pietro.panz...@treuropa.com - www.treuropa.com




-- 
Pietro Panzeri

Software Development Manager

Tele-Rilevamento Europa - T.R.E. srl
Via Vittoria Colonna, 7
20149 Milano – Italia
Tel.: +39.02.4343.121 - Fax: +39.02.4343.1230
pietro.panz...@treuropa.com - www.treuropa.com

_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to