Java – retrieves the size of the image in the file system

How to use @ L_ 301_ The size of the image retrieved from the local file system of 0 @ (usually JPEG, PNG, JPG and GIF)?

Solution

You can use Java's image class to get image properties This is a sample –

BufferedImage img = ImageIO.read(new File("imageFilePath"));
int height = img.getHeight();
int width = img.getWidth();
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>