“不支持的图像类型”只有少量图像的例外 [英] "Unsupported Image Type" exception in only few images

查看:128
本文介绍了“不支持的图像类型”只有少量图像的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的java-swing项目中。

我有一个框架,用户可以放下图像并将图像保存在数据库中。

现在这个工作完美但是它们是一些没有显示的图片。

这是图片图片1 图片2 ,不支持..这是一些图像不读...

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...

它显示我异常,例如

javax.imageio.IIOException:不支持的图像类型

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

我可以检查是否支持用户丢弃的图像?

我可以将不支持的文件转换为java中受支持的文件吗?

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?

推荐答案

是的,好吧,'javax.imageio'在不支持图像类型时完全抛出此异常。你可以捕获异常。这表明它不受支持,你可以从那里做任何你想做的事。

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.

根据定义你不能转换这个文件 - 而不是'javax.imageio ' 然后。但你可能会发现其他解析器可能会发生这种情况。它们看起来像有效的JPEG。

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.

这篇关于“不支持的图像类型”只有少量图像的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆