GeoffFirmin
0
Q:

base64 to image c#

public static Image LoadBase64(string base64)
{
	byte[] bytes = Convert.FromBase64String(base64);
    Image image;
    using (MemoryStream ms = new MemoryStream(bytes))
    {
        image = Image.FromStream(ms);
    }
    return image;
}
0
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;
    }
}
-1

New to Communities?

Join the community