2014.01.18 18:24 "[Tiff] Adding alpha to palette files", by John Hawley

2014.01.18 21:46 "Re: [Tiff] Adding alpha to palette files", by Bob Friesenhahn

Ok - I'm out of my comfort zone here and looking for a bit of guidance:

I'm in the process of writing a 3D dynamic mapping app which uses geotiff files as a data source. The dynamic nature of the mapping process means I am frequently re-writing numerous Geotiff as more data becomes available - so far so good - I've managed to automatically write these files using an 8-bit palette colour scheme and these are successfully read by gdal. My problem is that I really want the areas which have no data to be transparent i.e. I need to set an alpha channel. Now I've managed to understand from the documentation that I probably need to set EXTRASAMPLES_ASSOCALPHA and set my samples/pixel to 2?. However, I'm not sure how to actually add the alpha data. A snippet of sample code to go about this would be very helpful

While I am sure that a smart programmer could manage to produce a valid palette image with associated alpha, it can only possibly work for images with unusal properties. The problem is that alpha is spacially oriented while the palette is not. Associated alpha premultiplies the color with the transparency. Most software would not be able to reach such images correctly.

I strongly recommend not trying to create a palette image with an alpha channel. If you really need this then perhaps a format like PNG is more appropriate.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/