using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace binary_data_converted_into_image
{
public class DecodeBase64Binary
{
public static void Main(string[] args)
{
//
// Read the contents of Encoded Bitmap from the text file.
//
TextReader reader = new StreamReader(@"f:\Water lilies.txt");
String imageString = reader.ReadLine();
//
// Decode the Base64-Encoded binary whic previously read from the
// text file above.
//
byte[] imageBytes = Convert.FromBase64String(imageString);
//
// Create a new image file.
//
FileStream fs = new FileStream(@"C:\New Water lilies.jpg", FileMode.Create, FileAccess.Write);
BinaryWriter writer = new BinaryWriter(fs);
try
{
for (int i = 0; i < imageBytes.Length; i++)
{
writer.Write(imageBytes[i]);
}
}
finally
{
writer.Close();
fs.Close();
}
Console.ReadLine();
}
}
}
//--------------
Be Different with excellent knowledge A Devloper Blog....
Subscribe to:
Post Comments (Atom)
AngularJS Basics - Part 1
AngularJS What is AngularJS · Framework by googl...
-
Make Your Own Notepad In this tutorial we will be making a simple C# Notepad with the option to Clear, Cut, Copy, Paste, Select All, Save...
-
What is View? A simple view can be thought of as a subset of a table. It can be used for retrieving data, as well as updating or deleting r...
No comments:
Post a Comment
Your comment is pending for approval