In c#, we can use Image.HorizontalResolution and Image.VerticalResolution.
But in java, how to get it?
I found ImageInfo.java
, but it only support a few image types.
http://kickjava.com/src/imageinfo/ImageInfo.java.htm
You can use Apache Commons Sanselan library to get image info: http://commons.apache.org/imaging/index.html.
final ImageInfo imageInfo = Sanselan.getImageInfo(file_);
final int physicalWidthDpi = imageInfo.getPhysicalWidthDpi();
final int physicalHeightDpi = imageInfo.getPhysicalHeightDpi();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With