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

Frank Warmerdam warmerdam at pobox.com
Thu Sep 22 11:11:05 EDT 2011


On 11-09-22 05:00 AM, Jan Hartmann wrote:
>
> 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,

I don't think the referenced post is related to your problem.  If you can
bundle up your situation I might be able to investigate tonight.

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/warmerda
and watch the world go round - Rush    | Geospatial Software Developer



More information about the gdal-dev mailing list