Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/402.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 获取图像分辨率(缓冲区图像)_Java_Maven - Fatal编程技术网

Java 获取图像分辨率(缓冲区图像)

Java 获取图像分辨率(缓冲区图像),java,maven,Java,Maven,如何获得图像的分辨率 BufferedImage theBufferedImage = ImageIO.read(new File("/tmp/foo.jpg")); int width = theBufferedImage.getWidth(); int height = theBufferedImage.getHeight(); int resolution = ??? 问候,, saromba您无法从缓冲图像中获取DPI或任何其他此类信息,您必须检查原始JPEG文件。它只是一个没有任何元

如何获得图像的分辨率

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

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

你是说DPI吗?是的。我指的是新闻部。是的,这是真的。如果你有一个图像文件,你可以这样做@梅苏特皮斯金是的,我就是这么说的。但是
buffereImage
本身并不包含这些信息。