Well, I stumbled onto a way to decode a JPEG image even faster than using ImageIO.
Here's the gist from SUN: http://java.sun.com/products/java-media/2D/samples/suite/Image/JPEGFlip.java Here's a snippet: BufferedImage bi1 = null; JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(new ByteArrayInputStream(imageBuffer)); bi1 = decoder.decodeAsBufferedImage(); It's twice as fast (takes half as long) as: readers = ImageIO.getImageReadersByFormatName("jpg"); reader = (ImageReader)readers.next(); reader.setInput(iis, true); bi1 = reader.read(0,null); AND -- the JPEGDecoder returns a BufferedImage with a DataBufferInt just like what I wanted. The problem is (there's always a problem) from the documentation of JPEGCodec: * This interface describes a JPEG data stream decoder. This decoder * takes an InputStream that contains JPEG encoded image data. The * JPEGImageDecoder will decode the JPEG image data according to the * parameters set in a JPEGDecodeParam object. The resulting image * data is returned in either a Raster or a BufferedImage. * * Note that the classes in the com.sun.image.codec.jpeg package are not * part of the core Java APIs. They are a part of Sun's JDK and JRE * distributions. Although other licensees may choose to distribute these * classes, developers cannot depend on their availability in non-Sun * implementations. We expect that equivalent functionality will eventually * be available in a core API or standard extension. * * @see JPEGCodec * @see JPEGDecodeParam * @see Raster * @see BufferedImage * @version 4 December 1997 That's right -- ten years ago we were promised " equivalent functionality will eventually be available in a core API or standard extension. " What we have now is certainly not equivalent if it takes twice as long to do a similar thing. And what I get when I (unknowingly) ask for what was promised ten years ago is a demeaning and derogatory "...re-write your applet..." I don't have very positive feelings about the Java2D team right now. [Message sent by forum member 'demonduck' (demonduck)] http://forums.java.net/jive/thread.jspa?messageID=284583 =========================================================================== 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".
