[gdal-dev] GDAL alpha channels

Craig Bruce csbruce at cubewerx.com
Wed May 30 13:26:18 PDT 2012


Even Rouault <even.rouault at mines-paris.org> wrote:

> There will be likely a compatibility problem if we do this, because
> GDAL up to now writes TIFF RGBA images with EXTRASAMPLE_ASSOCALPHA
> (pre-multiplied), but I think in most cases the data that people have
> feed in the GTiff driver was not pre-multiplied. So if we un-premultiply
> this would cause issues in case the alpha value is not 0 or 255.

You only need to deal with altering the raw data on reading if the GTiff
driver were changed to always write unassociated alphas.  Also, if people
have been writing non-pre-multipled samples to associated-alpha files in
the existing interface, then the TIFF data is damaged in any case.

> The temporary conclusion of that is that there are likely images in
> the wild where the value of the flag does not reflect the reality
> of the imagery values... But, GDAL should likely be fixed to set
> EXTRASAMPLE_UNASSALPHA to better reflect the way it is generally used
> (presumably).

There's not much you can do about damaged images in the wild.  However,
we can try to prevent more from being created.

--------------------------+----------------------+--------------------------
Dr. Craig S. Bruce        | Ph 819-771-8303 x205 |             CubeWerx Inc.
Senior Software Developer |   Fax 819-771-8388   |  Gatineau, Québec, Canada
csbruce at cubewerx.com      |  http://csbruce.com/ |  http://www.cubewerx.com/
--------------------------+----------------------+--------------------------
     "I don't have to take this abuse from you -- I've got hundreds of
         people waiting to abuse me!" --Bill Murray, "Ghostbusters"


More information about the gdal-dev mailing list