windowsapptutorials.com
C# Base64 String to PNG Image - Windows App Tutorials
Here’s how you can save a base64 encoded string to image file in C#. public void SaveImageFile(string filename, string base64Image) { string destinationImgPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Constants.UserImagesPath+"\\"+filename+".png"; try { Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Constants.UserImagesPath); } catch (IOException iox) { Console.WriteLine(iox.Message+" "+iox.Data); } var bytes = Convert.FromBase64String(base64Image); using (var imageFile = new FileStream(destinationImgPath, FileMode.Create)) { imageFile.Write(bytes, 0, bytes.Length); [...]
Windows App Tutorials