簡體   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