[英]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.