Convert Image to Base64

Gopesh9
Posted by Gopesh9 under ASP.NET category on | Points: 40 | Views : 1459
public string ConvertImageToBase64(Image image, System.Drawing.Imaging.ImageFormat format)
{
using (MemoryStream mem = new MemoryStream())
{
image.Save(mem, format);
byte[] iBytes = mem.ToArray();
string baseS = Convert.ToBase64String(iBytes);
return baseS;
}
}

Comments or Responses

Login to post response