public static Dimension getImageSize(final InputStream is, final String fileName) throws ImagingException, IOException {
        return getImageSize(ByteSource.inputStream(is, fileName));
    }
Determines the width and height of an image.

@param is       InputStream from which to read image data.
@param fileName File name associated with image data (optional).
@return The width and height of the image.
@throws ImagingException if it fails to parse the image
@throws IOException      if it fails to read the image data
src/main/java/org/apache/commons/imaging/Imaging.java