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
精彩评论