在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public Bitmap GetImageFromBase64(string base64string) { byte[] b = Convert.FromBase64String(base64string); MemoryStream ms = new MemoryStream(b); Bitmap bitmap = new Bitmap(ms); return bitmap; } public string GetBase64FromImage(string imagefile) { string strbaser64 = ""; try { Bitmap bmp = new Bitmap(imagefile); MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] arr = new byte[ms.Length]; ms.Position = 0; ms.Read(arr, 0, (int)ms.Length); ms.Close(); strbaser64 = Convert.ToBase64String(arr); } catch (Exception) { throw new Exception("Something wrong during convert!"); } return strbaser64; }
|
请发表评论