"Unsupported Image Type" exception in only few images
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 ex开发者_JAVA技巧ception, 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?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.
精彩评论