Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4330388
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:57:20+00:00 2026-05-21T09:57:20+00:00

I am trying to change the code http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download from picture box to image or

  • 0

I am trying to change the code http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download 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.

I have tried changing the webcam.cs from PictureBox _FrameImage to Bitmap _FrameImage and PictureBox ImageControl to Bitmap ImageControl and casting (Bitmap) at e.WebCamImage

As well as changing it on the main form:

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();
}
  • 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 ?

The source code I am using is:
http://sites.google.com/site/webcamlibrarydotnet/winfrom-and-csharp-sample-code-and-download

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:57:21+00:00Added an answer on May 21, 2026 at 9:57 am

    Instead of using the WebCam class, why not just use the WebCamCapture class directly (since you are not displaying this in a form) and handle the ImageCapture event directly. The event argument for the event contains the Image. You could, in the event handler save the image to disk. Alternately, if you want to use the sample and the WebCam class, and you have a form. Use a PictureBox but leave it hidden (set Visible to false) and then just copy the image from there and save to disk when you need to.

    Here is some sample code of using the WebCamCapture class instead of the WebCam class. It should be noted that this code is based on the sample code from the link provided in the question. I have kept the style of the sample so that code lines up.

    Edit: Adding example of using WebCamCapture instead of WebCam class. This code should be used to modify Form1.cs in the sample code.

    // Instead of having WebCam as member variable, have WemCamCapture
    WebCamCapture webCam;
    
    // Change the mainWinForm_Load function
    private void mainWinForm_Load(object sender, EventArgs e)
    {
        webCam = new WebCamCapture();
        webCam.FrameNumber = ((ulong)(0ul));
        webCam.TimeToCapture_milliseconds = 30;
        webCam.ImageCaptured += webcam_ImageCaptured;
    }
    
    // Add the webcam Image Captured handler to the main form
    private void webcam_ImageCaptured(object source, WebcamEventArgs e)
    {
        Image imageCaptured = e.WebCamImage;
        // You can now stop the camera if you only want 1 image
        // webCam.Stop();
        // Add code here to save image to disk
    }
    
    // Adjust the code in bntStart_Click
    // (yes I know there is a type there, but to make code lineup I am not fixing it)
    private void bntStart_Click(object sender, Event Args e)
    {
        webCam.Start(0);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying the following code http://code.google.com/apis/ajax/playground/#change_the_playing_video It works well when runned from the playground
I am trying to use google search for my site: http://www.houseofhawkins.com/search.php It is not
I am trying to install sqlitegen(http://code.google.com/p/sqlitegen/) plugin for my android development. I downloaded the
I have the following code that i am trying to change from a regular
I'm using code I found for a jquery style sheet switcher. From here: http://www.cssnewbie.com/simple-jquery-stylesheet-switcher/
Here's the C# code directly from the website ( http://jobijoy.blogspot.com/2007/10/time-picker-user-control.html ) that everyone refers
While trying the google plus API example from the project site I'm completely stuck
I'm writing some Javascript code and I'm trying to change the current page as
I'm trying to update/change contact ringtone using this code: ContentValues values = new ContentValues();
am trying to read web page from java code and its fine for general

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.