0

I build an app that allows the user to capture an image and then save it to both the isolated storage and the phone's Media Library.

When I download these two pictures to my PC, I see that the one saved in isolated storage has a resolution of 2592x1944 pixels and 262 dpi, while the one saved in Media Library is 1222x1630 and 72 dpi. I cannot explain why this happens. My related code-behind is:

//Save image to isolated storage
Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);

//Save image to Media Library
MediaLibrary medialibrary = new MediaLibrary();
medialibrary.SavePicture(imageName, e.ChosenPhoto;);

(wb is a WritableBitmap that is created from e.ChosenPhoto)

Icarus
  • 139
  • 2
  • 13

1 Answers1

0

I'd assume it has something to do with saving it from the ChosenPhoto instead of from a WriteableBitmap. Try saving the picture to the media library from Isolated Storage instead like this.

// Encode WriteableBitmap object to a JPEG stream.
Extensions.SaveJpeg(wb, fileStream, wb.PixelWidth, wb.PixelHeight, 0, 85);
fileStream.Close();

// Create a new stream from isolated storage, and save the JPEG file to the media library on Windows Phone.
fileStream = store.OpenFile(tempJPEG, FileMode.Open, FileAccess.Read);

MediaLibrary mediaLibrary = new MediaLibrary();
Picture pic = mediaLibrary.SavePicture("savedflimage.jpg", fileStream);
fileStream.Close();
Bryant
  • 8,660
  • 1
  • 33
  • 53
  • I implemented this and what happens is that the image from Media Library is still 1222x1630 but the dpi is improved: 165 dpi. Weird, isn't it? – Icarus Dec 22 '12 at 17:41