| When org.geotools.gce.imagemosaic.jdbc.ImageComposerThread::createDataBufferFilledWithNoDataValues() initializes a buffer for the image it always uses noDataValue from the raster read from the database. This is ok for rasters without an alpha channel but for rasters with the alpha channel (with an exception of raster noDataValue equal to 0) it results in areas not covered by the rasters in the database not being displayed as transparent (see the attachment). In my opinion if the raster contains an alpha channel, then the valid noDataValue for the createDataBufferFilledWithNoDa() method is always 0. This is because at this point raster was already converted to a java.awt.Image, where transparent pixels must have alpha channel value of 0 (and the noDataValue of the original raster read from the database does not influence it in any way). To solve the problem the createDataBufferFilledWithNoDataValues() method should get another parameter - hasAlpha - allowing it to set the noDataValue properly: Number noDataValue = hasAlpha ? 0 : levelInfo.getNoDataValue(); and the createDataBufferFilledWithNoDataValues() call in the org.geotools.gce.imagemosaic.jdbc.ImageComposerThread constructor should be as follows: DataBuffer dataBuffer = createDataBufferFilledWithNoDataValues(raster, colorModel.getPixelSize(), colorModel.hasAlpha()); I can prepare a pull request on GitHub providing these changes. |