0

I want to get a certain photo from the Camera Roll album, resize it and save it to my isolated storage so I can bind to it later - how would I go about it?

    using (var library = new MediaLibrary())
    {
        PictureAlbumCollection allAlbums = library.RootPictureAlbum.Albums;
        PictureAlbum cameraRoll = allAlbums.Where(album => album.Name == "Camera Roll").FirstOrDefault();
        var CameraRollPictures = cameraRoll.Pictures;
    }

Here is how I obtain my photos - my understanding is that I need to somehow write it to a writablebitmap, but I fail to see how to go about it. Please advise

Rafał Saltarski
  • 707
  • 1
  • 8
  • 20

2 Answers2

2

you can do this using WriteableBitmapExWinPhone.dll

private void DoResize()
{
    WriteableBitmap wBitmap = new WriteableBitmap(objBitmapImage);
    wBitmap = wBitmap .Resize(50, 100, WriteableBitmapExtensions.Interpolation.Bilinear);
}
Mahdi Ghiasi
  • 14,873
  • 19
  • 71
  • 119
Archana
  • 376
  • 2
  • 12
1

Yes! Of course you have to use WriteableBitmap Class to re-size an image.

Have a look following code snippet for the same.

private void DoResize()
        {
            WriteableBitmap wBitmap = new WriteableBitmap(objBitmapImage);
            MemoryStream mStream = new MemoryStream();
            wBitmap.SaveJpeg(mStream, 50, 50, 0, 100);
        }

Hope it helps.

Pavan
  • 533
  • 5
  • 15