Reading BufferedImage with DestinationType

M

Mike

hi all!

i am trying to read images into a BufferedImage with TYPE_INT_RGB.

Iterator it = ImageIO.getImageReadersBySuffix("jpg");
ImageReader r = (ImageReader) it.next();
ImageInputStream in = ImageIO.createImageInputStream(new
FileInputStream("c:\\tmp\\bigimg.jpg"));
r.setInput(in);

ImageReadParam irp = r.getDefaultReadParam();
ImageTypeSpecifier imgt =
ImageTypeSpecifier.createFromBufferedImageType(BufferedImage.TYPE_INT_ARGB);
irp.setDestinationType(imgt);

BufferedImage img = r.read(0, irp);

==>
javax.imageio.IIOException: Destination type from ImageReadParam does not
match!
at javax.imageio.ImageReader.getDestination(Unknown Source)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown
Source)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(Unknown Source)


PLEASE help me out.

thanks a lot!

mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top