Question

I am using this code to get images from my webcam, I guess its Metricam library

Anyone knows how to get images without using picturebox?

WebCam camera = new WebCam();
camera.Connect();
pictureBox1.Image = camera.GetBitmap();
pictureBox1.Image.Save(@"c:\image1 " + ".Jpeg", ImageFormat.Jpeg);
Was it helpful?

Solution

pictureBox1.Image is Image type. It can handle saving on its own. It does handle saving when used from PictureBox too, notice how you call Save() method on Image property and not on pictureBox instance.

WebCam camera = new WebCam();
camera.Connect();
Image image = camera.GetBitmap();
image.Save(@"c:\image1 " + ".Jpeg", ImageFormat.Jpeg);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top