繁体   English   中英

获取图像分辨率(theBufferedImage)

[英]Get image resolution ( theBufferedImage )

我如何获得图像的分辨率。

BufferedImage theBufferedImage = ImageIO.read(new File("/tmp/foo.jpg"));
int width = theBufferedImage.getWidth();
int height = theBufferedImage.getHeight();
int resolution = ???

此致saromba

您无法从BufferedImage获取DPI或任何其他此类信息,您必须为其检查原始JPEG文件。 它只是一个没有任何元数据的光栅图像。 如果要将BufferedImage写入文件,则可以设置DPI。 但是BufferedImage本身没有DPI的概念,只是像素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM