2

Trying to resolve this for days - (WP7) got it working 1st time in Win 8, help appreciated..

Simply I want to read a JPEG from my Isolated Storage, Convert the JPEG to Writable bitmap and then mess with the pixels. The code I'm currently trying is this, copied mostly from this site :-).. problem is that when I look at wbm (WritableBitmap) .pixels they are all -1.. the Memory stream is a proper JPEG, but I want a Bitmap..

BitmapImage bi = new BitmapImage();

using (IsolatedStorageFile myIsolatedStorage =         IsolatedStorageFile.GetUserStoreForApplication())
{
   using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(s, FileMode.Open, FileAccess.Read))
     {
      bi.SetSource(fileStream);

      fileStream.Position = 0; // just in case..
      WriteableBitmap wbm = new WriteableBitmap(bi);
      wbm.LoadJpeg(fileStream);
  }
}

also tried inserting the following ---

bi.CreateOptions = BitmapCreateOptions.None;
bi.ImageOpened += (x, e) =>
 {
     WriteableBitmap wbm = new WriteableBitmap((BitmapImage)x);
 };

to ensure the Bitmap is loaded..

Thanks in advance for any help

John Irvine
  • 156
  • 2
  • 7
  • Just a tip for asking questions: leave out unnecessary stuff like isolated storage. Get to the core: "How to load an image from disk and change the pixels?" – usr Feb 13 '13 at 20:57

0 Answers0