I can confirm it happens only if JAI/ImageIO are not installed in the JDK, regardless of whether geoserver is set up to use native JAI accel or not.
Now, I would love some guidance on what I'm doing wrong. With the above mentioned set up, if you look at GeoServerMetaTile.writeTileToStream, you'll see that the meta tile image is a
BufferedImagetype = 5 ColorModel: #pixelBits = 24 numComponents = 3 color space = java.awt.color.ICC_ColorSpace@14b25f37 transparency = 1 has alpha = false isAlphaPre = false ByteInterleavedRaster: width = 512 height = 1024 #numDataElements 3 dataOff[0] = 2
The tile was created like tile = img.getSubimage(minX, minY, tileWidth, tileHeight); which only happens when the metatile is a BufferedImage, otherwise CropDescriptor/TranslateDescriptor are used.
So my suspect is the convertion of the metatile generated by GeoServer (a RenderedOp) into a BufferedImage (a measure taken when native JAI is not available), which happens at MetaTile.setImage:
public void setImage(RenderedImage metaTiledImage) {
if (!(metaTiledImage instanceof BufferedImage) && !nativeAccelAvailable()
&& ImageMime.jpeg.equals(responseFormat)) {
if (metaTiledImage.getSampleModel().getNumBands() > 3) {
metaTiledImage = BandSelectDescriptor.create(metaTiledImage, new int[] { 0, 1, 2 },
null);
}
Raster raster = metaTiledImage.getData();
DataBuffer data = raster.getDataBuffer();
SampleModel sampleModel = raster.getSampleModel().createCompatibleSampleModel(
metaTiledImage.getWidth(), metaTiledImage.getHeight());
Point location = new Point(raster.getMinX(), raster.getMinY());
WritableRaster writableRaster = WritableRaster.createWritableRaster(sampleModel, data,
location);
ColorModel colorModel = metaTiledImage.getColorModel();
boolean alphaPremultiplied = colorModel.isAlphaPremultiplied();
this.metaTiledImage = new BufferedImage(colorModel, writableRaster, alphaPremultiplied,
null);
} else {
this.metaTiledImage = metaTiledImage;
}
}
Is the band selection wrong or something?
This is very odd, I'm sure I tested both raster and vector layers in all supported formats and with JDK5/6 with and without JAI/ImageIO installed just before the release... Will look into it asap though