string imgname = DateTime.Now.ToString("yyyyMMddhhmmss") + ".gif";
string zipPath = AppDomain.CurrentDomain.BaseDirectory;
string filesPath = zipPath + (zipPath.EndsWith("\\") ? "" : "\\") + "GzImage\\";
if (!Directory.Exists(filesPath))
{
Directory.CreateDirectory(filesPath);
}
string filename = filesPath + imgname;
byte[] arr = Convert.FromBase64String(Img64Str);//base64转byte
string newImg64Str = Encoding.Default.GetString(arr);//解密
byte[] arr2 = Convert.FromBase64String(newImg64Str);//base64转byte
using (MemoryStream ms2 = new MemoryStream(arr2))
{
System.Drawing.Bitmap bmp2 = new System.Drawing.Bitmap(ms2);
bmp2.Save(filename, System.Drawing.Imaging.ImageFormat.Gif);
bmp2.Dispose();
}