Is there a simple way to save the contents of the variable WriteableBitmap to IsolatedStorageFile? I am writing a program that processes the pixels in a WriteableBitmap, and then saves the processed bitmap as file *.bmp and stores it in the "saved pictures" directory. I have code that saves the WriteableBitmap as a jpeg file, but as I said before I do not want to compress graphics in any way. Please help me to solve my problem.
private void Save_as_bmp(object sender, RoutedEventArgs e) { String temp = "photo.bmp"; using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { if (myIsolatedStorage.FileExists(temp)) { myIsolatedStorage.DeleteFile(temp); } IsolatedStorageFileStream fileStream = myIsolatedStorage.CreateFile(tempJPEG); //Writeable wb declared in another method //JPEG compression //wb.SaveJpeg(fileStream, wb.PixelWidth, wb.PixelHeight, 0, 100); // In this place I need to save variable wb to file stream without any compression // something like - fileStram = wb.content; fileStream.Close(); } using (IsolatedStorageFile myIsolatedStorage2 = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream fileStream2 = myIsolatedStorage2.OpenFile("photo.bmp", FileMode.Open, FileAccess.Read)) { try { var mediaLibrary2 = new MediaLibrary(); mediaLibrary2.SavePicture("raster_graphic", fileStream2); //mediaLibrary2.SavePictureToCameraRoll("raster_graphic", fileStream2); MessageBox.Show("Image saved"); //fileStream2.Close(); } catch (Exception ex) { MessageBox.Show("Error, exception: " + ex.Message); } } } }