1

In my java-swing project.
I have one frame in which user can drop the images and save that images in database.
Now this work perfectly but their are some images which is not showing.
This are images Image 1 , Images 2 which is not supporting .. this are some images which are not reading...

and its showing me exception, like
javax.imageio.IIOException: Unsupported Image Type

Can i check that, is the image which user had dropped is supported or not?
And can i convert that file which is not supported into supported file in java?

Nitz
  • 1,690
  • 11
  • 36
  • 56
  • A similar question got much better answers. See http://stackoverflow.com/questions/2408613/problem-reading-jpeg-image-using-imageio-readfile-file – Pino Oct 11 '11 at 14:19

1 Answers1

3

Yes, well, 'javax.imageio' throws this exception exactly when the image type is not supported. You can catch the exception. This is your indication it's not supported and you can do whatever you wish from there.

By definition you can't convert this file then -- not with 'javax.imageio' then. But you could find other parsers out there maybe that happen to read the file. They do seem like valid JPEGs.

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • ya..exactly i tried to catch that exception and do all the stuff but how to render that kind of file? – Nitz May 24 '10 at 08:51
  • Just render a prepared file, containing something like "Image type not supported, choose another one". – George May 24 '10 at 08:59