title: Android: Get height/width from byte array or file
body: <p>I have an image that is stored as a byte array (can also be accessed from Android directory as a .jpg) and I'm trying to get the width and height of the image. I've tried to use javax.imageio however Dalvik doesn't support this lib, so I've opted to use Bitmap. Can anyone help me out here? I keep getting Null Pointer Exceptions.</p>
  
  <pre><code>public int getWidth(byte[] image) throws IOException{
      Bitmap bitmapImage = BitmapFactory.decodeFile(image.toString());
      int imageWidth = bitmapImage.getWidth();
  
      return imageWidth;
  }
  </code></pre>
  
  <p>Cheers.</p>