boutique replica bags up ideas

the best replique rolex and prices here.

julia highlight 99j hair color 10a quality straight human hair lace front wigs 8 - 24 inches pre plucked hairline 13x4 inches lace front brazilian wig onlinefor sale

C# Convert Base64 String to Bitmap Image Example

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;
        }
    }
}

Download Complete Source Code


C#

Leave a Reply