title: How to send binary image from Android to JavaScript
body: <p>I have a Hybrid Android app and I'm trying to send a binary image file from Android to a webview so that I can use JavaScript to rotate/crop it.</p>
  
  <p>I tried converting it to a base64 string and sending it that way but it took way too long and sometimes would never finish sending. This is what I have currently:</p>
  
  <pre><code>public String bitMapToBase64(){
      ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
      //add support for jpg and more.
      bitMap.compress(Bitmap.CompressFormat.PNG, 50, byteArrayOutputStream);
      byte[] byteArray = byteArrayOutputStream .toByteArray();
  
      String encoded = Base64.encodeToString(byteArray, Base64.DEFAULT);
  
      return encoded;
  }
  </code></pre>
  
  <p>Is there a way to send the data as binary and receive it as binary on the webview and then convert it to a File object with JavaScript?</p>
  
  <p>Is there a more efficient way of trying to do this?</p>