// Clear the ColorModel mask if needed.
ColorModel cm = il.getColorModel(null);
if(cm != null &&
!JDKWorkarounds.areCompatibleDataModels(sm, cm)) {
// Clear the mask bit if incompatible.
il.unsetValid(ImageLayout.COLOR_MODEL_MASK);
}
// Force the tile grid to be identical to that of the source.
il.setTileGridXOffset(source.getTileGridXOffset());
il.setTileGridYOffset(source.getTileGridYOffset());