EXIF images and InputStream mark/reset not supported

Discussion in 'Java' started by OtisUsenet, Sep 6, 2007.

  1. OtisUsenet

    OtisUsenet Guest

    Hi,

    I'm using Java2D to scale (resize) images. In the process I deal with
    InputStream that contains the image, and I use mark(0) + reset() calls
    on this InputStream. I noticed this invariably bombs with certain
    types of images, such as this one:

    $ file ~/background-images/More.JPG
    /home/otis/background-images/More.JPG: JPEG image data, EXIF standard
    2.1

    But it always works with images of this type:

    $ file ~/background-images/Falkusa.jpg
    /home/otis/background-images/Falkusa.jpg: JPEG image data, JFIF
    standard 1.01

    By "bombs" I mean this:
    java.io.IOException: mark/reset not supported
    at java.io.InputStream.reset(InputStream.java:334)
    ....
    ....

    So the difference is that one uses EXIF standard and the other one
    uses JFIF standard.
    Is there any way to avoid this this and get mark/reset type
    functionality even with EXIF images?

    Thanks!
     
    OtisUsenet, Sep 6, 2007
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.