title: How to convert and store bitmapImages in Windows8
body: <p>I want to store bitmapimages on local directory. And I wrote those codes.but An unknown error occurred and can't compile.please tell me the cause of the error and the the right way to convert and store bitmapImages.</p>
  
  <pre><code>    void StoreAndGetBitmapImage()
      {
          BitmapImage image = new BitmapImage(new Uri("ms-appx:///Assets/" + "test.png"));
          StorageFile storageFile = ConvertBitmapImageIntoStorageFile(image, "image_name");
          StoreStorageFile(storageFile);
          BitmapImage resultImage = GetBitmapImage("image_name");
      }
  
      StorageFile ConvertBitmapImageIntoStorageFile(BitmapImage bitmapImage,string fileName)
      {
          StorageFile file = Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(bitmapImage.UriSource).GetResults();
          file.RenameAsync(fileName);
          return file;
      }
  
      void StoreStorageFile(StorageFile storageFile)
      {
          storageFile.CopyAsync(Windows.Storage.ApplicationData.Current.LocalFolder);
      }
  
      BitmapImage GetBitmapImage(string fileName)
      {
          BitmapImage bitmapImage;
          bitmapImage = new BitmapImage();
  
          bitmapImage.UriSource = new Uri(new Uri(
               Windows.Storage.ApplicationData.Current.LocalFolder.Path + "\\" +
               Windows.Storage.ApplicationData.Current.LocalFolder.Name),
               fileName);
  
          return bitmapImage;
      }
  </code></pre>