[gdal-dev] Support for the premultiplied alpha channels

Tamas Szekeres szekerest at gmail.com
Sun Mar 16 17:36:22 EDT 2008


Here is an example to demonstrate the effect of  the incorrect alpha
consideration. I've composed a tiff created with adobe photoshop (and
loaded by GDAL C#) with a white-gray hatch background.

In the first case I've read the image as Pixelformat.Format32bppArgb
(with non premultiplied alpha):
http://vbkto.dyndns.org:1280/non_pre_overlay.png

In the second case I've loaded the same raster into Pixelformat.Format32bppPArgb
http://vbkto.dyndns.org:1280/pre_overlay.png

The latter is the correct.

Best regards,

Tamas



2008/3/16, Tamas Szekeres <szekerest at gmail.com>:
> Frank,
>
>  I really got confused because of this :-((  It seems the the various
>  formats use different alpha representations by default. In this regard
>  I really don't know how to take care of this in an application without
>  having to consider the format actually used.
>  For example tiff uses pre-multiplied alpha by default (related to
>  EXTRASAMPLE_ASSOCALPHA = 1), but however, other formats like png uses
>  non premultiplied by default (AFAIK). Because of this reason the upper
>  level application won't really know which relationship to be used when
>  combining these images.
>  This is not an issue for GDAL itself but a significant problem for the
>  upper level applications. The drivers should at least denote which
>  alpha representation is actually used.
>
>
>  Best regards,
>
>  Tamas
>
>
>
>
>  2008/3/16, Frank Warmerdam <warmerdam at pobox.com>:
>
> > Tamas Szekeres wrote:
>  >  > Folks,
>  >  >
>  >  > Do we have any support to use bitmaps with premultiplied alpha
>  >  > channels? I think there are some raster formats that can convey these
>  >  > types of images and the viewers can take care of this option.
>  >  >
>  >  > The only thing I'd like to see is to be able to determine if the image
>  >  > actually uses premultiplied alpha regardless of whether the drivers
>  >  > actually support this or not at the moment.
>  >  >
>  >  > But currently I don't see which is the right place to denote this
>  >  > option. I consider this is a dataset wide property rather that
>  >  > attached to a single band.
>  >
>  >
>  > Tamas,
>  >
>  >  There is no GDAL way of expressing whether image bands are premultipled
>  >  with alpha (unfortunately).
>  >
>  >  Best regards,
>  >
>  > --
>  >  ---------------------------------------+--------------------------------------
>  >  I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
>  >  light and sound - activate the windows | http://pobox.com/~warmerdam
>  >  and watch the world go round - Rush    | President OSGeo, http://osgeo.org
>  >
>  >
>


More information about the gdal-dev mailing list