Opened 11 years ago

Closed 6 years ago

Last modified 6 years ago

#3669 closed enhancement (fixed)

[PATCH] gdal_merge.py alpha mask

Reported by: stefanklug Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: Utilities Version: unspecified
Severity: normal Keywords:
Cc:

Description

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

Attachments (1)

gdal_merge.patch (2.6 KB) - added by stefanklug 11 years ago.

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by stefanklug

Attachment: gdal_merge.patch added

comment:1 Changed 7 years ago by Jukka Rahkonen

This patch has never been reviewed.

comment:2 Changed 7 years ago by Jukka Rahkonen

Summary: gdal_merge.py alpha mask[PATCH] gdal_merge.py alpha mask

comment:3 Changed 6 years ago by fxthomas

The patch worked for me on GDAL 1.10.1, so +1. The raster files I work on generally have alpha masks, which makes gdal_merge.py unusable for most of my use cases.

comment:4 Changed 6 years ago by Even Rouault

Milestone: 2.0
Resolution: fixed
Status: newclosed

trunk r29213 "gdal_edit.py: take into account alpha band to avoid writing zones of source images that are fully transparent (#3669, derived from patch by stefanklug)"

comment:5 Changed 6 years ago by Even Rouault

Above changeset caused regression. See #6067

comment:6 Changed 6 years ago by Even Rouault

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.