title: C# How to get image from array of bytes (blob converted into array of bytes)?
body: <p>We are saving a picture from android app to MySQL blob. Now we want to get that image in C#. Can anyone suggest a equivalent code for C#? We want to show original image. I have successfully retrieved data from database. it is returning me array of bytes.I have tried lots of methods but I am getting image with small size and with low quality   </p>
  
  <pre><code>public String getStringImage(Bitmap bmp){
     ByteArrayOutputStream baos=new ByteArrayOutputStream();
     bmp.compress(Bitmap.CompressFormat.JPEG, 100, baos);
     byte[] imageBytes= baos.toByteArray();
     String encodedImage= Base64.encodeToString(imageBytes, Base64.DEFAULT)
     return encodedImage;
  }
  </code></pre>
  
  <p>I have tried below code
  C# code</p>
  
  <pre><code>byte[] dbBytes = (byte[])dtCameraImage.Rows[0]["Image"];
  
                  if (dbBytes.Length &gt; 0)
                  {
                      string s_unicode2 = System.Text.Encoding.UTF8.GetString(dbBytes);
  
                      byte[] bytes = Convert.FromBase64String(s_unicode2);
  
                      if (bytes.Length &gt; 0)
                      {
                          using (var ms = new MemoryStream(bytes))
                          {
                              img = new Bitmap(ms);
                              //img.Save("C:\\Newfolder\\test2.jpg");
                              imgImagePopup.Source = ConvertToImgSource(img);
                          }
                      } 
                  }
  </code></pre>