public void TestGetPictureWH(MultipartFile logo) throws IOException {
BufferedImage image = ImageIO.read(logo.getInputStream());
int width = 0;
int height = 0;
if (!ObjectUtils.isEmpty(image)) {
width = image.getWidth();
height = image.getHeight();
}
System.out.println("width:" + width + ";;;height:" + height);
}
测试图像的宽度和高度是3000 * 4000,但结果是“ width:4000 ;;; height:3000”-这是一个错误。但是,当我使用2000 * 2500图片测试时,可以为什么?
该问题已解决,原因是通过手机拍摄的照片旋转了90度。