bufferedimage获得的宽度和高度相反

问题描述 投票:0回答:1
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图片测试时,可以为什么?

java image debugging io bufferedimage
1个回答
0
投票

该问题已解决,原因是通过手机拍摄的照片旋转了90度。

© www.soinside.com 2019 - 2024. All rights reserved.