title: Converting image from azure blob storage to Base64?
body: <p>I'm trying to convert image from Azure blob storage  to base64:</p>
  
  <pre><code>private static string FromAzureToBase64(string azureUri)
  {
      Uri blobUri = new Uri(azureUri);
      CloudBlockBlob blob = new CloudBlockBlob(blobUri, StorageAccount.Credentials);
  
      byte[] arr = new byte[blob.Properties.Length];
      blob.DownloadToByteArray(arr, 0);
      var azureBase64 = Convert.ToBase64String(arr);
      return azureBase64;
  }
  </code></pre>
  
  <p>The problem with <code>arr</code> parameter is that I should define its length, but the value of <code>blob.Properties.Length</code> is -1, however the image exists on Azure, but almost all its properties either null or unspecified:</p>
  
  <p><a href="https://i.stack.imgur.com/D8Sba.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D8Sba.png" alt="enter image description here"></a></p>