rabeea nasser

rabeea nasser

  • NA
  • 10
  • 6.6k

convert picturebox.resourse to byte[] Array WPF C#

Jun 13 2013 7:10 AM
i need help in converting image(picturebox.resourse) to byte array (byte[]) in WPF
id used this code : but it cannot resolve second line 
"Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);"
my code is :
MemoryStream ms = new MemoryStream();
picturebox.Resources.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] pic_arr = new byte[ms.Length];
ms.Position = 0;
ms.Read(pic_arr, 0, pic_arr.Length);
 

Please If You can help me I would be grateful.

Answers (6)