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);
有帮助吗?

解决方案

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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top