[gdal-dev] Using the alpha channel to mask parts of an image

Jan Hartmann j.l.h.hartmann at uva.nl
Thu Sep 22 08:00:03 EDT 2011


Hi,

I have a set of unreferenced RGB images with black borders I want to cut 
off. I do this by adding a fourth alpha band to the image when warping 
it, and filling this with 255 within the data rectangle, and 0 outside, 
using gdal_rasterize ( I have the exact georeferenced boundaries of the 
image as vector data). Nothing happens. When I do the same thing for the 
first three bands, results are as expected, but whatever I do with the 
fourth band has no effect at all.

Theoretically, this should work, but is there a problem with gdal's 
implementation of alpha transparency? The following post seems to 
suggest it:

http://osgeo-org.1803224.n2.nabble.com/gdal-dev-Need-help-generating-output-with-alpha-channels-using-Python-API-td6169886.html

I didn't try out the suggested solution yet, as I would prefer the 
simpler method above. Is there really a problem with gdal's handling of 
alpha transparency, or is there another workaround?

Jan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110922/ee4677a4/attachment.html


More information about the gdal-dev mailing list