Search code examples
wpfimageviewload

How to load a very large sourceimage in WPF image?


I have a very large image (600mb) 30000x30000 and want to load it into a wpf image control.

I can watch this image with the Windows Photo Viewer!

I set my testapp to 64bit and used the following code.

var image = new BitmapImage();
image.BeginInit();

// load into memory and unlock file
image.CacheOption = BitmapCacheOption.OnLoad;

image.UriSource = uri;

image.EndInit();

imagecontrol.source = image;

The test app just shows a white screen with this large image.

Smaller ones like 100mb and 7000x7000 are working.

What am I doing wrong? Sry for my bad english and thanks in advance.


Solution

  • 64-Bit Applications.

    As with 32-bit Windows operating systems, there is a 2GB limit on the size of an object you can create while running a 64-bit managed application on a 64-bit Windows operating system.