[gdal-dev] gdal_merge.py alpha mask

Stefan Klug Klug.Stefan at gmx.de
Wed Jun 30 06:36:31 EDT 2010


Am 29.06.2010 18:23, schrieb Chaitanya kumar CH:
> Stefan,
>
> I haven't tested the script but doesn't the current code copy the 
> alpha band? If it does, it might be more preferable to copy all the 
> pixels and the alpha band.
Yes the current code copies the alpha band, but it uses the same nodata 
settings as the other bands.
This gets interesting if I want to merge overlapping images which define 
their valid area by an alpha channel. In the current code, I would have 
to specify nodata=0 to get the alpha channel to merge correctly. This is 
counterintuitive, as I expect images with alpha to merge correctly 
without specifying a value for nodata.
If nodata isn't specified the merged alpha of overlapping images is 
incorrect (as opaque areas get overwritten with the transparent parts 
(nodata) )
>
> Please create a ticket at http://trac.osgeo.org/gdal/newticket and 
> attach your patch.
Done... http://trac.osgeo.org/gdal/ticket/3669

Regards
Stefan
>
> On Tue, Jun 29, 2010 at 8:19 PM, Stefan Klug <Klug.Stefan at gmx.de 
> <mailto:Klug.Stefan at gmx.de>> wrote:
>
>     Hi,
>
>     gdal_merge.py doesn't handle tiff files with alpha masks so I've
>     added this functionality.
>
>     My patch changes the behaviour of gdal_merge as follows:
>     - If a band is recognized as Alpha Band it is automatically
>     treated as having a NODATA value of 0.
>     I'm not sure if this is the way to go. But it makes some sense, as
>     the resulting alpha channel is a correct alpha merge, independent
>     of the nodata value used for the other bands.
>     - If a band has mask flag GMF_ALPHA set, the mask band controls
>     the parts that get written to the destination
>
>     Would be great if someone could review and possibly checkin the patch.
>
>     Regards
>        Stefan
>
>
>
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> -- 
> Best regards,
> Chaitanya kumar CH.
> /tʃaɪθənjə/ /kʊmɑr/
> +91-9494447584
> 17.2416N 80.1426E


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


More information about the gdal-dev mailing list