标签:raw for class 图片 efi ima img stat osi
/// <summary> /// 图片转Base64 /// </summary> /// <param name="ImageFileName">图片的完整路径</param> /// <returns></returns> public static string ImgToBase64(string ImageFileName) { try { Bitmap bmp = new Bitmap(ImageFileName); 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(); return Convert.ToBase64String(arr); } catch (Exception) { return null; } }
标签:raw for class 图片 efi ima img stat osi
原文地址:https://www.cnblogs.com/flamegreat/p/12195742.html