问题:
ImageIO.read()在读取本地图片时因为图片格式造成各种问题,可以采用以下方案代替
代替方案:
使用commons-imaging包的Imaging.getImageInfo()来实现图片信息的获取
# 导入包
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-imaging</artifactId>
<version>1.0-alpha2</version>
</dependency>
#示例
File imageFile = new File("xxxx.jpg");
ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
System.out.println("imageInfo:" + imageInfo);