Opened 14 years ago

Closed 9 years ago

Last modified 9 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 14 years ago.

Download all attachments as: .zip

Change History (7)

by stefanklug, 14 years ago

Attachment: gdal_merge.patch added

comment:1 by Jukka Rahkonen, 9 years ago

This patch has never been reviewed.

comment:2 by Jukka Rahkonen, 9 years ago

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

comment:3 by fxthomas, 9 years ago

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 by Even Rouault, 9 years ago

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 by Even Rouault, 9 years ago

Above changeset caused regression. See #6067

comment:6 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.