开发者

Retrieve the dimensions of an image in the filesystem

开发者 https://www.devze.com 2023-04-06 04:45 出处:网络
How can I r开发者_Go百科etrieve the dimensions of an image (typically jpeg, png, jpg and gif), in the local filesystem with Java?You can use java\'s image class to get image attributes. Here is the sa

How can I r开发者_Go百科etrieve the dimensions of an image (typically jpeg, png, jpg and gif), in the local filesystem with Java?


You can use java's image class to get image attributes. Here is the sample -

BufferedImage img = ImageIO.read(new File("imageFilePath"));
int height = img.getHeight();
int width = img.getWidth();


how about this: getting image metadata

0

精彩评论

暂无评论...
验证码 换一张
取 消