Opened 16 years ago

Closed 14 years ago

#2640 closed defect (fixed)

[PATCH] Use GDAL transparency masks

Reported by: rouault Owned by: warmerdam
Priority: normal Milestone: 6.0 release
Component: GDAL Support Version: unspecified
Severity: normal Keywords: gdal transparency mask
Cc: sdlime, hobu

Description

From GDAL >= 1.5.0, the concept of transparency mask has been introduced. See RFC 15.

This patch uses dataset transparency masks when no alpha band is available. It reads the mask band and simulates as if it was an alpha band, so the impact on existing code is minimum.

Attachments (5)

transparency_mask.map (521 bytes ) - added by rouault 16 years ago.
To test with "./shp2img -m transparency_mask.map -o result.tif -l TEST -s 200 200 -e 0 0 19 19"
test_with_mask_1bit.tif (780 bytes ) - added by rouault 16 years ago.
Grey level image with transparency mask
test3_with_1mask_1bit.tif (1.6 KB ) - added by rouault 16 years ago.
RGB image with transparency mask
result.tif (732 bytes ) - added by rouault 16 years ago.
Expected result : grey square at the centre of a red background
mapdrawgdal_transparency_mask.patch (2.2 KB ) - added by rouault 16 years ago.
Patch to use GDAL transparency masks (updated not to be triggered with BANDS keyword)

Download all attachments as: .zip

Change History (12)

by rouault, 16 years ago

Attachment: transparency_mask.map added

To test with "./shp2img -m transparency_mask.map -o result.tif -l TEST -s 200 200 -e 0 0 19 19"

by rouault, 16 years ago

Attachment: test_with_mask_1bit.tif added

Grey level image with transparency mask

by rouault, 16 years ago

Attachment: test3_with_1mask_1bit.tif added

RGB image with transparency mask

comment:1 by rouault, 16 years ago

Note : the above attached TIFF images have internal transparency masks, that are only handled on GDAL trunk >= r14647.

by rouault, 16 years ago

Attachment: result.tif added

Expected result : grey square at the centre of a red background

comment:2 by sdlime, 16 years ago

Component: MapServer C LibraryGDAL Support
Owner: changed from sdlime to warmerdam

Changing component to "GDAL Support"... I can apply but would like Frank's blessing.

Steve

comment:3 by sdlime, 16 years ago

Cc: sdlime added; warmerdam removed

comment:4 by rouault, 16 years ago

I've discovered the existence of msautotest/gdal, and of course by testing it, I discovered that my patch introduced a regression in unclassified.map, where the PROCESSING "BANDS=1,2,3" directive excludes the alpha component of the RGBA image from being taken into account. So I'm updating the patch not to try to use transparency masks when the BANDS keyword is used in PROCESSING. This way the test suite passes fine again.

Patch updated.

by rouault, 16 years ago

Patch to use GDAL transparency masks (updated not to be triggered with BANDS keyword)

comment:5 by rouault, 15 years ago

Cc: hobu added

comment:6 by warmerdam, 14 years ago

Milestone: 6.0 release
Status: newassigned

I have incorporated a slight variation on the patch in trunk (r10002).

comment:7 by warmerdam, 14 years ago

Resolution: fixed
Status: assignedclosed

Implemented test in test suite based on provided sample files (r10003) and incorporated the check for GDAL 1.5 or newer (r10004).

Thanks Even - sorry for the delay in incorporating.

Note: See TracTickets for help on using tickets.