不知道为什么你不能加载只有600 MB,而限制是2GB的32位。 在任何情况下,你可以通过这样的转换器减少内存使用:
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var url = values[0] as string;
var imageConrol =(Image)values[1];
var container = (FrameworkElement)imageConrol.Parent;
if (string.IsNullOrEmpty(url) || container.ActualHeight<= 0)
{
return null;
}
var bi = new BitmapImage();
bi.BeginInit();
bi.CacheOption = BitmapCacheOption.None;
bi.CreateOptions = BitmapCreateOptions.IgnoreColorProfile;
bi.DecodePixelHeight = (int)container.ActualHeight;
bi.UriSource = new Uri(url, UriKind.Absolute);
// End initialization.
bi.EndInit();
bi.Freeze();
return bi;
}
从MSDN
// Create Image Element
Image myImage = new Image();
myImage.Width = 200;
// Create source
BitmapImage myBitmapImage = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block
myBitmapImage.BeginInit();
myBitmapImage.UriSource = new Uri(@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water Lilies.jpg");
// To save significant application memory, set the DecodePixelWidth or
// DecodePixelHeight of the BitmapImage value of the image source to the desired
// height or width of the rendered image. If you don't do this, the application will
// cache the image as though it were rendered as its normal size rather then just
// the size that is displayed.
// Note: In order to preserve aspect ratio, set DecodePixelWidth
// or DecodePixelHeight but not both.
myBitmapImage.DecodePixelWidth = 200;
myBitmapImage.EndInit();
//set image source
myImage.Source = myBitmapImage;
http://msdn.microsoft.com/en-us/library/ms748873.aspx
确切的问题。400mb tif图像作为图像源.Wpf出现了一个白色的屏幕。没有检测到内存使用情况,通过编译针对特定x64平台的应用程序来解决这个问题,但是为什么?我仍然不明白,为什么? –