C# 读取图片转成Base64编码
作者:互联网
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 }
标签:byteArray,pic,读取,filePath,C#,Base64,File,图片,string 来源: https://www.cnblogs.com/heidashuaiGo/p/16554490.html