Converting back from Base64 String to Image USING C#.

vishalneeraj-24503
Posted by vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 2721
Write below code:-

public Image Base64ToImage(string base64String)
{
//First Convert Base64 String to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
MemoryStream ms = new MemoryStream(imageBytes,0,imageBytes.Length);

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

Comments or Responses

Login to post response