title: How to save PictureBox.Image to file?
body: <p>I use the following to write jpgImage to a PictureBox.Image.</p>
  
  <pre><code>var jpgImage = new Byte[jpgImageSize];
  ...
  pictureBox.Image = new Bitmap(new MemoryStream(jpgImage));
  </code></pre>
  
  <p>and I can use the following to write a byte array to a file</p>
  
  <pre><code>using (var bw =
      new BinaryWriter(File.Open(filename, FileMode.Create,
          FileAccess.Write, FileShare.None)))
  {
      bw.Write(jpgImage);
  }
  </code></pre>
  
  <p>but how can I get the jpgImage byte array from the PictureBox.Image so I can write it to the file?
  IOW: how do I reverse the following to get the byte array from the PictureBox.Image?</p>
  
  <pre><code>pictureBox.Image = new Bitmap(new MemoryStream(jpgImage));
  </code></pre>