none
Save Kinect RGB to JPG file on the disk WPF C#. RRS feed

  • Question

  • I am trying to save the Kinect RGB feed, which is displayed on an image into a jpg file using the following code:

        private void Button_Click_1(object sender, RoutedEventArgs e)
            {
                using (FileStream stream = File.Create(@"d:\1.jpg"))
                {
                    JpegBitmapEncoder encoder = new JpegBitmapEncoder();
                    encoder.Frames.Add(BitmapFrame.Create(MainViewer.Source as BitmapSource));
                    encoder.Save(stream);
                }
    
    
                }

    But it gives me the following error:

    An unhandled exception of type 'System.ArgumentNullException' occurred in PresentationCore.dll

    Please help.

    Friday, February 7, 2014 5:52 PM