虚位以待(AD)
虚位以待(AD)
首页 > 软件编程 > WindowsPhone/WindowsMobile > Windows Phone 7有损,缩略图的生成

Windows Phone 7有损,缩略图的生成
类别:WindowsPhone/WindowsMobile   作者:码皇   来源:互联网   点击:

我在读取相册的时候每个图片都太大了!我就想有没有可以生成缩略图的方式来显示这样可以节省手机内存下面是代码 思路,不能跑起来Image pici = new Image();BitmapImage bi = new BitmapImage();Memory

我在读取相册的时候每个图片都太大了!
我就想有没有可以生成缩略图的方式来显示这样可以节省手机内存
 
下面是代码 思路,不能跑起来
 
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;
 
 
但是发现处理后手机内存占用更大了,无奈没有采用,不知道有什么好的方法!

 

 

摘自 贝壳笨

相关热词搜索: Windows Phone 有损