Using Java ImageIO to read embedded thumbnails in JPEG images

Discussion in 'Java' started by Enric Tordera, Oct 13, 2006.

  1. I'm trying to write some code to read the embedded thumbnails present in
    JPEG images from digital cameras. I am using the ImageIO library

    This is the code:

    ---------------------------------------------------
    ImageInputStream iis = ImageIO.createImageInputStream(new
    FileInputStream(filename));

    Iterator readers = ImageIO.getImageReadersByFormatName("jpg");
    ImageReader reader = null;
    while (readers.hasNext()) {
    reader = (ImageReader)readers.next();
    if (reader.readerSupportsThumbnails()) {
    reader.setInput(iis, true);
    System.out.println("NumThumbnails:" + reader.getNumThumbnails(0));
    }
    }
    ----------------------------------------------



    It always prints "0", so it seems the library can't find any Thumbnail
    in the JPEG file, although I'm sure it is there.

    Here are the questions:
    * May be the embedded thumbnail is in the EXIF information, so ImageIO
    does not support it?
    * Is there another ImageReader available that fully supports reading
    thumbnails?
    * Any hint on how to do this?

    Thanks in advance for your help.

    - Enric
    Enric Tordera, Oct 13, 2006
    #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. F C
    Replies:
    2
    Views:
    5,133
  2. Max
    Replies:
    1
    Views:
    391
    David Zimmerman
    Mar 7, 2004
  3. Patrick
    Replies:
    1
    Views:
    721
  4. Davidski
    Replies:
    0
    Views:
    3,870
    Davidski
    Nov 5, 2004
  5. Ben Phillips
    Replies:
    10
    Views:
    2,294
    Ben Phillips
    Aug 15, 2008
Loading...

Share This Page