BitmapSource.Save

Aug 5, 2011 at 6:09 PM

Hello

I supposed that "BitmapSource.Save(string fileName, ImageFormat format)" record the frames but I don't find any images in the wpf project. I wonder what can the "BitmapSource.Save" do?

Thanks, you make much easy work with Kinect SDK.

I'm new with C# and I need to record all the stream, could you give any idea?

Aug 5, 2011 at 9:33 PM

so you'd do something like the following:   

void RuntimeColorFrameReady(object sender, ImageFrameReadyEventArgs e)
{
   e.ImageFrame.ToBitmapSource().Save("catpure.jpg", ImageFormat.Jpeg);
}

Does that make sense? Or what you can do is if you have an Image control is do:

myImageControl.Source.Save("catpure.jpg", ImageFormat.Jpeg);

This code would save that image in the YourProject/bin/Debug/ directory.  If you built the project in release mode it would be YourProject/bin/Release/

If you did something like .Save("c:\\myImg\\current.jpg", ImageFormat.Jpeg); the image would be in your c:\myImg directory

Nov 23, 2011 at 5:29 AM
crutkas wrote:

so you'd do something like the following:   

 

void RuntimeColorFrameReady(object sender, ImageFrameReadyEventArgs e)
{
   e.ImageFrame.ToBitmapSource().Save("catpure.jpg", ImageFormat.Jpeg);
}

 

 

Does that make sense? Or what you can do is if you have an Image control is do:

myImageControl.Source.Save("catpure.jpg", ImageFormat.Jpeg);

This code would save that image in the YourProject/bin/Debug/ directory.  If you built the project in release mode it would be YourProject/bin/Release/

 

 If you did something like .Save("c:\\myImg\\current.jpg", ImageFormat.Jpeg); the image would be in your c:\myImg directory

Hi! I have a question.

What is the type of the variable myImageControl?

What is the namespace for using this variable?

Thanks!

Dec 3, 2011 at 9:58 PM

Assumption:  You are doing a WPF application

myImageControl is a System.Windows.Controls.Image type.  What you get in return from ToBitmapSource is a BitmapSource which has the base type of ImageSource.  This means anywhere that accepts an ImageSource, you can leverage BitmapSource.

so the XAML in your application would be <Image Name="myImageControl" />

Check out the Coding4Fun.Kinect.Wpf.TestApplication for sample usage.