Frage

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);
War es hilfreich?

Lösung

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);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top