public static Bitmap GetImageFromBase64String(string strBase)
{
try
{
MemoryStream stream = new MemoryStream(Convert.FromBase64String(strBase));
Bitmap bitmap = new Bitmap(stream);
return bitmap;
}
catch(Exception ex)
{
return null;
}
}
public static string GetBase64StringFromImage(Image image, ImageFormat imageFormat)
{
string strRst = string.Empty;
try
{
MemoryStream stream = new MemoryStream();
image.Save(stream, imageFormat);
strRst = Convert.ToBase64String(stream.GetBuffer());
}
catch (Exception ex)
{}
return strRst;
}