C# Base64 String to JPEG Image - Stack Overflow

PHOTO EMBED

Sat Apr 16 2022 03:07:08 GMT+0000 (Coordinated Universal Time)

Saved by @javicinhio #cs

public Image Base64ToImage(string base64String)
{
   // Convert Base64 String to byte[]
    byte[] imageBytes = Convert.FromBase64String(base64String);
    MemoryStream ms = new MemoryStream(imageBytes, 0, imageBytes.Length);

    // Convert byte[] to Image
    ms.Write(imageBytes, 0, imageBytes.Length);
    Image image = Image.FromStream(ms, true);

    return image;
}
content_copyCOPY

https://stackoverflow.com/questions/18827081/c-sharp-base64-string-to-jpeg-image