1 /// <summary> 2 /// 根据图片的路径解析成图片资源 3 /// </summary> 4 /// <param name="filePath"></param> 5 /// <returns></returns> 6 public static string BitmapImageToByteArray(string filePath) 7 { 8 byte[]? byteArray = null; 9 if (File.Exists(filePath)) 10 byteArray = File.ReadAllBytes(filePath); 11 string pic = Convert.ToBase64String(byteArray); 12 return pic; 13 }
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/279123.html