📜  将图像转换为 base64 C# 代码示例

📅  最后修改于: 2022-03-11 14:49:03.540000             🧑  作者: Mango

代码示例1
using (Image image = Image.FromFile(Path))
{
    using (MemoryStream m = new MemoryStream())
    {
        image.Save(m, image.RawFormat);
        byte[] imageBytes = m.ToArray();

        // Convert byte[] to Base64 String
        string base64String = Convert.ToBase64String(imageBytes);
        return base64String;
    }
}