Wednesday, June 6, 2012

How to Access Image Dimensions from MultipartFile in Java

Here's how to access image dimensions from MultipartFile:
java.awt.image.BufferedImage image = javax.imageio.ImageIO.read(new BufferedInputStream(multipartFile.getInputStream()));
System.out.println("Image height: " + image.getHeight());
System.out.println("Image width: " + image.getWidth());

No comments:

Post a Comment