2 Replies Latest reply on Nov 21, 2011 8:06 AM by Sci-Ware.AlexeiBlue

    How can I convert an image created in Photoshop into a format that Java's ImageIO library will take?

    Sci-Ware.AlexeiBlue

      Hi all,

       

      I've been trying to write an image resize tool to use the Lancoz resample algorithm to resize images to a high standard in Java.  The library with the algorithm/filter in it is mortennobel's image scaling library and it takes a buffered image as an input and returns the resized image as desired.  However the trouble I’m having is that the ImageIO library in Java, a standard library, which converts images given to its read method to buffered images doesn't accept certain images created in Photoshop and so it throws an exception.  My library needs to be fully automated to process possible thousands of images at a time and so manually converting them by resaving them as JPEG's is really feasibly.  Is there some way I can convert these images from Adobes Exif format to standard JFIF format?  I've tried simple inserting the APP0 marker from a JFIF image in-between the SOI and APP1 marker but the ImageIO library still failed.

       

      Exif Binary Screenshot.png

      The above image is a screenshot of the binary in hex of one of the images that cause an Invalid Format exception when passed to ImageIO.

       

      Any help you could offer me with this would be much appreciated.

       

      Kind regards and thank you,

      Alexei Blue

      Science Warehouse.