关于javax.imageio.IIOException: Invalid icc profile: bad sequence number
来源:互联网 发布:数据分析的好处 编辑:程序博客网 时间:2024/05/22 17:12
今天碰到项目有客户出现这个错误, 测试网也有, 但是有时候就没有, 很奇怪的问题。 查下了是JDK 的一个BUG。
BUG 地址: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6404011
大概意思是读取图片流的时候, 如果图片本身格式有问题, 他就会报 Invalid icc profile 错误。官网说是1.6已经修复了, 但是我已经是1.6 版本了, 没搞明白怎么回事。
然后找到一篇帖子说重写image可以解决。 参考地址:http://feicer.iteye.com/blog/803138#bc2345723
类似
File doc = new File(file);
FileInputStream inFile = new FileInputStream(doc);
JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(inFile);
BufferedImage image = decoder.decodeAsBufferedImage();
FileOutputStream outFile = new FileOutputStream(doc);
ImageIO.write(image, ‘JPEG’, outFile);
inFile.close();
outFile.close();
BufferedImage srcImage = ImageIO.read(doc);
// do Something (例如缩小图片)
- 关于javax.imageio.IIOException: Invalid icc profile: bad sequence number
- javax.imageio.IIOException: Invalid icc profile: bad sequence number
- ImageIO.read报错:javax.imageio.IIOException: Invalid icc profile: bad sequence number
- Invalid icc profile: duplicate sequence numbers
- javax.imageio.IIOException: Can't create output stream!
- javax.imageio.IIOException: Can't create output stream!
- javax.imageio.IIOException: Can't create output stream!
- javax.imageio.IIOException: Can't create output stream!
- 图片处理 javax.imageio.IIOException: Unsupported Image Type
- javax.imageio.IIOException: Can't create output stream解决方法
- javax.imageio.IIOException: Can't read input file!
- javax.imageio.IIOException: Can't create output stream解决方法
- javax.imageio.IIOException: Can't read input file!
- 使用javax.imageio.ImageIO生成验证码时报错javax.imageio.IIOException: Can't create output stream!
- javax异常: javax.imageio.IIOException: Can't create output stream解决方法
- JSP彩色验证码,javax.imageio.IIOException: Can't create output stream! 解决方法
- javax.imageio.IIOException: Can't create output stream! (生成验证码Servlet)
- 读取验证码时 Caused by: javax.imageio.IIOException: Can't create cache file!
- android CookieManager 用法
- boost::property_tree读取解析ini文件
- Spring事务描述器形式
- SVN 开源 源码
- MyBatis入门学习
- 关于javax.imageio.IIOException: Invalid icc profile: bad sequence number
- [Java]读取文件方法大全
- 微信公众平台接口开发——环境搭建1
- WPS面试经历
- EditPlus终极绿色版OD修改版问世:
- IT行业的岗位薪酬和自身定位
- 之:内核编译(众多前人的结晶)
- 他和她
- android 中apk如何防止反编译?