Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Convert image file to standard JPEG

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Thanked 0 Times in 0 Posts

    Question Convert image file to standard JPEG

    Hi Guys,

    Firstly I apologise if this is the wrong forum to post to but I thought it was the most sensible one.

    I have a program which rescales images using the mortennobel image library for the rescale filter/algorithm. I'm using the Java standard library ImageIO to read the file in to a BufferedImage object. However the trouble I'm having is that the ImageIO library only accepts common standard forms of images and so If the ImageIO.read() function throws an IOException I want to catch it and convert the image into a standard form such as a JPEG. I've tried a few conversion functions found online and I'm currently trying to use the Sanselan library which has been suggested in other forums.

    The biggest problem I'm having is that some of the images are not of a standard JPEG format i.e. FF D8 FF E0 JFIF, instead they have been produced by a digital camera or edited in photoshop and the format is FF D8 FF E1 Exif. When I tried to convert these files with conversion functions given in other forums it tends to change the colours or create a load of vertical lines in the new image. Is there anyway of converting images safely and if anyones used the Sanselan library to do it can you leave an example as I'm struggling to work out how to use the library correctly.

    Thanks in advanced,
    Alexei Blue.
    Last edited by AlexeiBlue; October 3rd, 2011 at 11:43 AM.

Similar Threads

  1. Convert file from any encoding to UTF-8
    By efluvio in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: June 26th, 2011, 01:16 AM
  2. How Convert a Byte array to a image format
    By perlWhite in forum Algorithms & Recursion
    Replies: 7
    Last Post: February 19th, 2011, 03:16 PM
  3. How do you convert a jar file into a java file, how ?
    By auto78900 in forum Java Theory & Questions
    Replies: 4
    Last Post: October 12th, 2010, 12:32 AM
  4. [SOLVED] Convert JFrame graphics into a jpeg file
    By Perd1t1on in forum AWT / Java Swing
    Replies: 4
    Last Post: June 22nd, 2010, 05:21 PM
  5. How to Convert DWG File to an Image
    By lance9200 in forum Java Theory & Questions
    Replies: 0
    Last Post: June 17th, 2010, 10:21 AM

Tags for this Thread