How to get an image type without knowing its file extension?
<p>I need to know a file extension without having the file extension? Is this possible with the java IO API?</p>

<p>I'm getting the following exception while reading a JPG file:</p>

<pre><code>javax.imageio.IIOException: Unsupported Image Type
</code></pre>

<p>Does anyone have any ideas how to solve this?</p>

<p>When i try to open the image in a normal image viewer in Mac OS X or Windows, it works just fine.</p>

<p>Is there any chances the file was renamed to a different type and it's original type is different from the extension?</p>
