1.将图片保存为文本文件
var ms = new MemoryStream();
pictureBox1.Image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
var buffer = new byte[ms.Length];
ms.Position = 0;
ms.Read(buffer, 0, buffer.Length);
ms.Close();
File.WriteAllText("demobase64.txt", Convert.ToBase64String(buffer));//保存为文本文件
2. 从文本文件中加载图片
string contents = File.ReadAllText("demobase64.txt");
Image image = Image.FromStream(new MemoryStream(Convert.FromBase64String(contents)));
pictureBox2.Image = image;