Access taken snapshot of WebCam

1 Answer 186 Views
WebCam
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Jana asked on 06 Aug 2021, 09:04 AM

Hello,

I would like to use the radWebCam to take snapshots. When taking a snapshot and afterwards clicking the saving button, it is automatically saved.

- Is there a possibility to modify this saving process? I would like to access the snapshot to display it in a picture box in my application
- In which directory the snapshots are saved?
- Can I chose the filename and the diractory to which a snapshot is saved?

Thank you and have a great weekend!

Jana

1 Answer, 1 is accepted

Sort by
1
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Aug 2021, 08:07 AM

Hi, Jana,

The SnapshotTaken event is quite useful for accessing the camera image when the preview is enabled. I would recommend you to have a look at the following help article which is quite useful on this topic: 

https://docs.telerik.com/devtools/winforms/controls/webcam/features/snapshots 

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Jana
Top achievements
Rank 2
Iron
Iron
Iron
commented on 09 Aug 2021, 12:09 PM | edited

Hello Dess,

thank you for your reply! 

Actually, it's more the process after clicking the little disk to save the snapshot that interests me. I don't want to save the image before the user clicks the corresponding button. To which directory the snapshot gets saved and can I somehow influence the filename of the taken snapshot when I click the button with the little disk? And does the click on the saving button fires another event?

 

Thank you in advance!

Dess | Tech Support Engineer, Principal
Telerik team
commented on 09 Aug 2021, 12:29 PM

Hi, Jana,

By default, the PreviewSnapshots property is enabled which means that when you take a snapshot by clicking the camera button, the image preview is displayed and once you click the Save button, the SnapshotTaken event will be fired. You have access to the image itself and you can save it wherever you want. RadWebCam doesn't have any default logic for storing this image anywhere on the local drives. It is up to the developer to save the image at certain location. I have prepared a sample code snippet for your reference demonstrating how to save the image to the desired path and with the desired name:

        public RadForm1()
        {
            InitializeComponent();

            this.radWebCam1.AutoStart = true;
            this.radWebCam1.PreviewSnapshots = true;
            this.radWebCam1.SnapshotTaken += radWebCam1_SnapshotTaken;
        }

        private void radWebCam1_SnapshotTaken(object sender, SnapshotTakenEventArgs e)
        {
            string filePath = @"..\..\test.png";
            e.Snapshot.Save(filePath, ImageFormat.Png);
            Process.Start(filePath);
        }

I believe that it would your scenario.

Jana
Top achievements
Rank 2
Iron
Iron
Iron
commented on 12 Aug 2021, 07:31 AM

Hi Dess,

Thank you again for your further explanation, I understood now. For me it was not clear that the SnapshotTaken event is fired when clicking the save button. I thought it will be fired when clicking the snapshot button. But now it's clear, thank you very much!

Tags
WebCam
Asked by
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or