public static ImageFormat guessFormat(final File file) throws IOException {
        return guessFormat(ByteSource.file(file));
    }
Attempts to determine the image format of a file based on its "magic numbers," the first bytes of the data.

<p>
Many graphics formats specify identifying byte values that appear at the beginning of the data file. This method checks for such identifying elements and
returns a ImageFormat enumeration indicating what it detects. Note that this method can return "false positives" in cases where non-image files begin
with the specified byte values.
</p>

@param file File containing image data.
@return An ImageFormat, such as ImageFormat.IMAGE_FORMAT_JPEG. Returns ImageFormat.IMAGE_FORMAT_UNKNOWN if the image type cannot be determined.
@throws IOException in the event of an unrecoverable I/O condition.
src/main/java/org/apache/commons/imaging/Imaging.java