C# convert between Image and Base64string

 static void ImageMSDemo(string picPath)
        {            byte[] imageArray = System.IO.File.ReadAllBytes(picPath);
            string base64ImageRepresentation = Convert.ToBase64String(imageArray);
            var img = Image.FromStream(new MemoryStream(Convert.FromBase64String(base64ImageRepresentation)));
            img.Save("newImg.jpg");
        }

 

posted @ 2019-10-28 18:52  FredGrit  阅读(110)  评论(0编辑  收藏  举报