using System.Drawing; using System.IO; using System.Drawing.Imaging; static void ConvertContentToImg() { using(Image img=Image.FromFile("c1.jpg")) { using(MemoryStream ms=new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); byte[] rawBytes = ms.ToArray(); string rawString = Encoding.UTF8.GetString(rawBytes); using(StreamWriter rawWriter=new StreamWriter("raw.txt",false,Encoding.UTF8)) { rawWriter.WriteLine(rawString); } Image img2 = Image.FromStream(ms); img2.Save("c5.jpg", ImageFormat.Jpeg); } } }