[Silverlight] How to choose the webcam resolution


Today I’m gonna show you how to choose the webcam resolution when using Silverlight. By default most of them are in 640x480 which can be sometimes insufficient.

VideoCaptureDevice source = devices.SelectedItem as VideoCaptureDevice; 
source.DesiredFormat = new VideoFormat(PixelFormatType.Unknown, 4096, 4096, 30);

The magic thing with this line, is that the camera will choose the best resolution available (and not absolutely 4096x4096).

You can also get all the supported formats using the SupportedFormats property.

Hope this help.

No Comments