javax.imageio.ImageReader.readRaster(..) returns raster with no color info.
javax.imageio.ImageReader.readRaster(0,null) will read a Raster about
10-20% faster than javax.imageio.ImageReader.read(0) will read a
BufferedImage. Not much unless one intends to do it on the order
of 100 times -- O(2). Which I do intend to do in a tiling applet.
But readRaster() returns a Raster with no ColorModel or ColorSpace
information. The docs say:
* Returns a new Raster object containing the raw pixel data
* from the image stream, without any color conversion applied. The
* application must determine how to interpret the pixel data by other
* means. Any destination or image-type parameters in the supplied
* ImageReadParam object are ignored, but all other
* parameters are used exactly as in the read(}
* This method allows formats that normally apply a color
* conversion, such as JPEG, and formats that do not normally have an
* associated colorspace, such as remote sensing or medical imaging data,
* to provide access to raw pixel data.
So that would be ok for my use. I could apply a ColorConvertOp to get the pixel
data into the color space that I wanted.
The only ColorConvertOp that works on Rasters needs a src ColorSpace and a dest
public ColorConvertOp(ColorSpace srcCspace,
The problem is you can't know what the src ColorSpace is just from inspecting
the Raster returned by readRaster().
So the question:
How do I find out what the ColorSpace is of the Raster returned by readRaster()?