Opened 12 years ago

Closed 12 years ago

#3208 closed defect (fixed)

PNG transparency of color 0 not working

Reported by: jake Owned by: jake
Priority: normal Milestone: 1.7.0
Component: GDAL_Raster Version: svn-trunk
Severity: minor Keywords: png transparency nodata
Cc:

Description

The NoDataValue? is not interpreted as a transparent color value when it is set to 0 in the PNGCreateCopy function. This applies to both gray scale and RGB images but not images with a palette.

If the image is of type RGB and the MetaItem? NODATA_VALUES is set to "0 0 0" the transparency value is correctly written to the PNG but not if GDALRasterBand::SetNoDataValue? function is used set the nodata value to 0 for the bands. If the image is of gray scale type the NODATA_VALUES is not used at all and GDALRasterBand::SetNoDataValue? does not work if the nodata value is 0.

Attachments (1)

pngdataset.patch (2.4 KB) - added by jake 12 years ago.
Patch for pgndataset.cpp to fix the reported bug

Download all attachments as: .zip

Change History (4)

comment:1 Changed 12 years ago by jake

Owner: changed from warmerdam to jake

Changed 12 years ago by jake

Attachment: pngdataset.patch added

Patch for pgndataset.cpp to fix the reported bug

comment:2 Changed 12 years ago by jake

Status: newassigned

comment:3 Changed 12 years ago by Even Rouault

Milestone: 1.7.0
Resolution: fixed
Status: assignedclosed

Thanks. I've applied in r18008 a small variation of your patch where I also test the bHaveNoData flag to avoid writing a transparency value when there is none in the source dataset

Note: See TracTickets for help on using tickets.