Windows Phone 7 有损 缩略图的生成!

我在读取相册的时候每个图片都太大了!

我就想有没有可以生成缩略图的方式来显示这样可以节省手机内存

 

下面是代码 思路,不能跑起来

Image pici = new Image();
BitmapImage bi = new BitmapImage();
MemoryStream stream = new MemoryStream(byte[]);
bi.SetSource(stream);
pici.Source = bi;
pici.Width = 1024;

WriteableBitmap wb = new WriteableBitmap(pici, null);
MemoryStream stream1 = new MemoryStream((int)pici.ActualHeight * (int)pici.ActualWidth * 4);
wb.SaveJpeg(stream1, (int)(pici.ActualWidth), (int)(pici.ActualHeight), 0, 100);
stream1.Seek(0, 0);
bi.SetSource(stream1);
stream = null;
pici = null;
wb = null;

 

但是发现处理后手机内存占用更大了,无奈没有采用,不知道有什么好的方法!

posted @ 2012-05-28 16:14  贝壳笨  阅读(554)  评论(6编辑  收藏  举报