Ticket #3208 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

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

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

Change History

Changed 4 years ago by jake

  • owner changed from warmerdam to jake

Changed 4 years ago by jake

Patch for pgndataset.cpp to fix the reported bug

Changed 4 years ago by jake

  • status changed from new to assigned

Changed 4 years ago by rouault

  • status changed from assigned to closed
  • resolution set to fixed
  • milestone set to 1.7.0

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.