title: WPF Image to byte[]
body: <p>I'm trying to convert from <code>System.Windows.Controls.Image</code> to <code>byte[]</code> and I didnt know which method from Image class could help in this scenary, by the way I really dont know what should I do, cause in my LINQ model the field appears as <code>Binary</code> type, I have to change this if I want to save it like a <code>byte[]</code> type?</p>
  
  <p>I found code posted here, but without using WPF: </p>
  
  <pre><code>Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight);
  System.IO.MemoryStream stream = new System.IO.MemoryStream();
  newBMP.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
  PHJProjectPhoto myPhoto = new PHJProjectPhoto {
      ProjectPhoto = stream.ToArray(), // &lt;&lt;--- This will convert your stream to a byte[] 
      OrderDate = DateTime.Now, 
      ProjectPhotoCaption = ProjectPhotoCaptionTextBox.Text,
      ProjectId = selectedProjectId
  };
  </code></pre>