开发者

"Unsupported Image Type" exception in only few images

开发者 https://www.devze.com 2023-01-01 00:29 出处:网络
In my java-swing project. I have one frame in which user can drop the images and save that images in database.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消