title: How to get image height and width using java?
body: <p>Is there any other way besides using <a href="https://docs.oracle.com/javase/8/docs/api/javax/imageio/ImageIO.html#read-java.io.File-" rel="noreferrer">ImageIO.read</a> to get image height and width?</p>
  
  <p>Because I encounter an issue that locks up the thread.</p>
  
  <pre><code>at com.sun.medialib.codec.jpeg.Decoder.njpeg_decode(Native Method)      
  at com.sun.medialib.codec.jpeg.Decoder.decode(Decoder.java:87)      
  at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader.decode(CLibJPEGImageReader.java:73)     
   - locked &lt;0xd96fb668&gt; (a com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader)      
  at com.sun.media.imageioimpl.plugins.clib.CLibImageReader.getImage(CLibImageReader.java:320)    
   - locked &lt;0xd96fb668&gt; (a com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader)     
   at com.sun.media.imageioimpl.plugins.clib.CLibImageReader.read(CLibImageReader.java:384)   
   - locked &lt;0xd96fb668&gt; (a com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader)      
  at javax.imageio.ImageIO.read(ImageIO.java:1400)      
  at javax.imageio.ImageIO.read(ImageIO.java:1322)
  </code></pre>
  
  <p>This error only occurs on a Sun app server and therefore I suspect that it is a Sun bug.</p>