can you get the RenderedImage first using readAsRenderedImage(), get the ColorModel/ColorSpace from there just 1 time, then do the rest of your tiling from that point?
> -----Original Message----- > From: Discussion list for Java 2D API > [mailto:[EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, June 17, 2008 3:38 PM > To: [EMAIL PROTECTED] > Subject: [JAVA2D] 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. > > NOPE! > > The only ColorConvertOp that works on Rasters needs a src > ColorSpace and a dest ColorSpace. > > public ColorConvertOp(ColorSpace srcCspace, > ColorSpace dstCspace, > RenderingHints hints) > > 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()? > [Message sent by forum member 'demonduck' (demonduck)] > > http://forums.java.net/jive/thread.jspa?messageID=280814 > > ============================================================== > ============= > To unsubscribe, send email to [EMAIL PROTECTED] and > include in the body of the message "signoff JAVA2D-INTEREST". > For general help, send email to [EMAIL PROTECTED] and > include in the body of the message "help". > =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".