Reading BufferedImage with DestinationType

Discussion in 'Java' started by Mike, Jun 29, 2005.

  1. Mike

    Mike Guest

    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
     
    Mike, Jun 29, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Szymanski
    Replies:
    0
    Views:
    901
    Peter Szymanski
    Jul 9, 2003
  2. Eel

    Copying BufferedImage

    Eel, Jul 9, 2003, in forum: Java
    Replies:
    2
    Views:
    7,041
  3. hz010c1877

    Read PPM images as BufferedImage

    hz010c1877, Aug 14, 2003, in forum: Java
    Replies:
    1
    Views:
    6,988
    John C. Bollinger
    Aug 14, 2003
  4. Morten Nørgaard
    Replies:
    0
    Views:
    3,458
    Morten Nørgaard
    Aug 29, 2003
  5. Mike Westerfield

    Transparent BufferedImage

    Mike Westerfield, Nov 1, 2003, in forum: Java
    Replies:
    1
    Views:
    4,722
    Andrew Thompson
    Nov 1, 2003
Loading...

Share This Page