[gdal-dev] tiff with colortable loses alpha values?

Even Rouault even.rouault at mines-paris.org
Tue Sep 28 13:29:24 EDT 2010


Vincent,

The TIFF format doesn't allow storing the alpha component, so it is ignored.

See the TIFF specification, section 5 : 
http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf

Possible workarounds :
* work with RGBA tiff
* add a mask band

Best regards,

Even

Le mardi 28 septembre 2010 16:24:18, Vincent Schut a écrit :
>   Hi,
> 
> I'm creating a geotiff with colortable using the python bindings,
> however, the alpha value of the colorentry is lost / always set to 255
> (says gdalinfo on the output image).
> Does gdal/geotiff with colortable not support rbga?
> Or, what am I doing wrong?
> 
> Testcase is below:
> 
> 
> from osgeo import gdal
> gtiff = gdal.GetDriverByName('GTiff')
> ds = gtiff.Create('/home/vincent/test.tif', 1, 1, 1, gdal.GDT_Byte)
> ct = gdal.ColorTable()
> ct.SetColorEntry(1, (100, 100, 100, 100))
> ds.GetRasterBand(1).SetColorTable(ct)
> 
> gdalinfo on /home/vincent/test.tif says 100,100,100,255 for colorentry 1...
> 
> using gdal from svn, internal geotiff.
> 
> Regards,
> Vincent.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list