New to Telerik UI for WinForms? Download free 30-day trial

Save Snapshot to File

This article shows how to take and save a snapshot to a file.

Setting up the Control

Add a RadWebCam to the form and subscribe to its SnapshotTaken event. In the event handler you have access to an Image object holding the snapshot. You can use this to save it to the file system.

Opening a file dialog in the SnapshotTaken event handler and saving it to a file

        private void radWebCam_SnapshotTaken(object sender, SnapshotTakenEventArgs e)
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.Filter = "Images|.png;.bmp;*.jpg";
            dialog.DefaultExt = ".png";
            dialog.FilterIndex = 0;
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)

     Private Sub RadWebCam_SnapshotTaken(ByVal sender As Object, ByVal e As SnapshotTakenEventArgs)
        Dim dialog As SaveFileDialog = New SaveFileDialog()
        dialog.Filter = "Images|.png;.bmp;*.jpg"
        dialog.DefaultExt = ".png"
        dialog.FilterIndex = 0

        If dialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
        End If
    End Sub       

Taking Snapshot

To take the snapshot press the "Take snapshot" button. Or call the TakeSnapshot method. This will fire the SnapshotTaken event.

By default, a preview of the snapshot will be shown that allows you to choose if it should be saved or not. If you choose to save it the SnapshotTaken event will fire. To disable the preview set the IsPreviewingSnapshot property of RadWebCam to false.

WinForms RadWebCam Save Snapshot to File

See Also

In this article