code: public static Point getSize(byte[] byteArray, int offset, int length) {
          BitmapFactory.Options options = new BitmapFactory.Options();
          options.inJustDecodeBounds = true;
          BitmapFactory.decodeByteArray(byteArray, offset, length, options);
          int width = options.outWidth;
          int height = options.outHeight;
          return new Point(width, height);
      }
docs: Get width and height of the bitmap specified with the byte array.
  @param byteArray the bitmap itself.
  @param offset offset index.
  @param length array length.
  @return the size.