How do I resize a BitmapImage to 50x50 on Windows Phone 7?

前端 未结 1 630
萌比男神i
萌比男神i 2021-01-14 23:13

I need to resize a BitmapImage to 50x50 before uploading it to my server. How do I do this on Windows Phone 7 with Silverlight C# .NET on the latest SDK 7.5?

1条回答
  •  时光说笑
    2021-01-14 23:44

    Try this

    WriteableBitmap wBitmap = new WriteableBitmap(yourBitmapImage);
    
    MemoryStream ms = new MemoryStream();
    
    wBitmap.SaveJpeg(ms, 50, 50, 0, 100);
    

    The stream will contain your resized image

    0 讨论(0)
提交回复
热议问题