public static string ImageToBase64(string imagePath)
{
//Image转base64
using (FileStream fs = new FileStream(imagePath, FileMode.Open))
{
byte[] bytes = new byte[fs.Length];
fs.Read(bytes, 0, bytes.Length);
string base64String = Convert.ToBase64String(bytes);
return base64String;
}
}
【C# 】图片转base64
于 2023-12-14 10:34:44 首次发布