Programming Tutorials

Convert Base64 String to Image in C#

By: Syed in Csharp Tutorials on 2011-01-10  

This tutorial will help you to learn how we can convert base64 string back to image.
public Image Base64ToImage(string base64String)
{
  // Convert Base64 String to byte[]
  byte[] imageBytes = Convert.FromBase64String(base64String);
  MemoryStream ms = new MemoryStream(imageBytes, 0, 
    imageBytes.Length);

  // Convert byte[] to Image
  ms.Write(imageBytes, 0, imageBytes.Length);
  Image image = Image.FromStream(ms, true);
  return image;
}





Add Comment

* Required information
1000

Comments

No comments yet. Be the first!

Most Viewed Articles (in Csharp )

Latest Articles (in Csharp)