Updated on Kisan Patel
This post will show you example of C# program to Convert Base64 string to Bitmap Image.
using System; using System.Drawing; using System.Drawing.Imaging; using System.IO; namespace Base64DemoConsoleApp { class Program { static void Main(string[] args) { //Convert Base64 string to Bitmap Bitmap bmpFromString = Base64StringToBitmap("Your Base64 string"); //Get the save image path string path = Path.Combine(@"C:\images\", "Image.jpg"); var i2 = new Bitmap(bmpFromString); //Save Image to folder i2.Save(path, ImageFormat.Jpeg); } public static Bitmap Base64StringToBitmap(string base64String) { Bitmap bmpReturn = null; //Convert Base64 string to byte[] byte[] byteBuffer = Convert.FromBase64String(base64String); MemoryStream memoryStream = new MemoryStream(byteBuffer); memoryStream.Position = 0; bmpReturn = (Bitmap)Bitmap.FromStream(memoryStream); memoryStream.Close(); memoryStream = null; byteBuffer = null; return bmpReturn; } } }