首页 > 编程语言 > 详细

javax.imageio.IIOException: Can't read input file!

时间:2019-11-16 17:06:31      阅读:84      评论:0      收藏:0      [点我收藏+]

做项目用到Thumbnails,给图片添加水印遇到了这个问题,记录一下!

//源代码
public class ImageUtil { public static void main(String[] args) throws IOException { String basePath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); System.out.println(basePath); Thumbnails.of(new File("G:\\不限速的百度云\\ssm校园商铺\\xiaohuangren.jpg")).size(200, 200) .watermark(Positions.BOTTOM_RIGHT, ImageIO.read(new File(basePath + "/shuiyin.jpg")), 0.25f) .outputQuality(0.8f).toFile("G:\\不限速的百度云\\ssm校园商铺\\xiaohuangrennew2.jpg"); } }
//异常信息
Exception in thread "main" javax.imageio.IIOException: Can‘t read input file!

 首先我的工程名用的中文,把路径打出来是这样的

/D:/Users/acer/%e9%a1%b9%e7%9b%ae%e5%ae%9e%e6%88%98/o2o/target/classes/

后面把工程名修改为英文之后,就没有这个异常啦!!!切忌,最好不要用中文命令项目以及工程名字!!!!

 

javax.imageio.IIOException: Can't read input file!

原文:https://www.cnblogs.com/yycy/p/11871954.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!