Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load a very large sourceimage in WPF image?

Tags:

image

wpf

view

load

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.

like image 433
Andreas Avatar asked Sep 10 '11 18:09

Andreas


1 Answers

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.

like image 71
Andreas Avatar answered Oct 03 '22 10:10

Andreas