title: how to convert an image into base64 in xamarin.android?
body: <p>I have this code, it works very well in android studio but not in xamarin 
  <strong>bitmap.Compress() has different arguments in xamarin</strong> and i am confused how to convert image into base64 or binary in xamarin.android? </p>
  
  <p>I am receving an error in the 3rd line:</p>
  
  <blockquote>
    <p>( bitmap.Compress() has some invalid arguments).</p>
  </blockquote>
  
  <pre><code>Bitmap bitmap = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ace1);
  ByteArrayOutputStream bao = new ByteArrayOutputStream();
  bitmap.Compress(Bitmap.CompressFormat.Jpeg, 100,bao);
  byte[] ba = bao.ToByteArray();
  string bal = Base64.EncodeToString(ba, Base64.Default);
  </code></pre>