/* Convert the picture to 64-bit encoding */
Find folder
System.IO.DirectoryInfo dd = new System.IO.DirectoryInfo ("C://qq");
Get all the files under the folder
system.io.fileinfo[] File = dd. GetFiles ();
Get the path to a file
String filePath = File[1]. DirectoryName + "\ \" + file[1]. Name;
Read this file with Streamread
System.IO.StreamReader sr = new StreamReader (FilePath, Encoding.default, true);
int index;
Instantiate a memory stream
System.IO.MemoryStream Tempstream = new MemoryStream ();
Converting a stream to a byte array
while (index = Sr. Basestream.readbyte ())! =-1)
{
Tempstream.writebyte (((byte) index));
}
byte[] array = Tempstream.toarray ();
Tempstream.close ();
Converts the resulting byte array to base64 bit encoding
string result = convert.tobase64string (array);
System.IO.File.WriteAllText ("c://zz.txt", result);
/* Convert 64-bit encoding to picture */
Converting 64-bit encodings to byte arrays
byte[] cc = convert.frombase64string (result);
Create a file with FileStream
FileStream fs = new FileStream ("C://a.jpg", FileMode.Create);
BinaryWriter bw = new BinaryWriter (FS);
Bw. Write (CC);
C # pictures and conversion of 64-bit encoding