title: PictureBox to Bitmap or Image?
body: <p>I am trying to change the code <a href="http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download" rel="nofollow">http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download</a> from picture box to image or bitmap as I dont want to display any image or plan to display, all I want is that it will output the image to file.</p>
  
  <p>I have tried changing the webcam.cs from <code>PictureBox _FrameImage</code> to <code>Bitmap _FrameImage</code> and <code>PictureBox ImageControl</code> to <code>Bitmap ImageControl</code> and casting (Bitmap) at <code>e.WebCamImage</code></p>
  
  <p>As well as changing it on the main form:</p>
  
  <pre><code>private void bWebcam_Click(object sender, EventArgs e)
  {
      WebCam webcam = new WebCam();
      Bitmap image = null;
      webcam.InitializeWebCam(ref image);
  
      webcam.Start();
      webcam.Stop();
  
      FileStream fstream = new FileStream("testWebcam.jpg", FileMode.Create);
      image.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
      fstream.Close();
  }
  </code></pre>
  
  <ul>
  <li><strong>Unhappyly it doesnt seem to work so
  how could I change it from picture
  box to Bitmap or Image or similar
  storage before saving it to a file or
  save it to file directly ?</strong></li>
  </ul>
  
  <p>The source code I am using is:
  <a href="http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download" rel="nofollow">http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download</a></p>