Update : My buddy Tim Heuer pointed out that when you are saving an image to the library, you need to make sure that you have the correct orientation. Instead of repeating the information here, I will instead point you to his great blog post on the subject. GO HERE to check it out.
In the last post, we showed you how to capture a picture in your application when hooking to the ‘extras’ menu on windows phone. Once you have manipulated the picture you will want to save it in the media library. In this post we will walk you through the steps to do that.
Once you have made the changes to the picture you captured (Crop, Color, Black and White, whatever), you then want to save your image to IsolatedStorage.
To do this we first need to add a using statement to the top of our class file.
Remember in our last post we saved the image returned from the camera in a WriteableBitMap. (see below code above //Save to Global Bitmap)
(This is the code from the last post – We only added the last line)
We are going to continue this code by first adding it to a Global Variable placed inside App.xaml.cs called Captured Image
Now that we have that saved globally, we want to first save the picture to IsolatedStorage THEN to the media library. This would normally be done when an event is fired, like a user clicking a save button.
First save the image to isolated storage
We then use the file we just saved to create a stream so we can save it to the media library
And that’s all you need to do.
In the next post we will show you how to use the WPConnect.exe tool to Debug your application without using Zune. This allows you to navigate to the pictures hub while still connected to Visual Studio.
Happy Coding – Daniel Egan – DotNetDoc