What is the maximum resolution of C# .NET Bitmap? -


theoretically, should 65,535 x 65,535 given have enough memory, 17gb.

however, creating .net 4.5 console application test out, throws system.argumentexception: parameter not valid.

the application built 64bit platform. running on 64bit platform 32gb of memory. maximum resolution i've been able 22,000 x 22,000 pixels.

i not find documentation on this.

and odd behavior @ 22,000 x 22,000 pixels, doesn't work. works, , throws exception. make me think it's related contiguous memory allocation, there 30gb of free memory.

does have experience this? , if wanted work say, 100,000 x 100,000 pixel image , larger, best way besides implementing own bitmap?

edit: problem isn't .net maximum object size. can overcome targeting 64bit platforms, , setting gcallowverylargeobjects flag in application config. in way, can application consume on 15gb of memory single array of integers. far, answer seems lie in underlying implementation of gdi+, how around it?

this gdi+ limitation imposed windows. gdi+ creates memory-mapped file view pixel data of bitmap. makes efficient, bitmaps tend large , mmf helps keep pixel data out of paging file. ram pages can discarded , re-read file. rather notorious, lots of programmers have seen save() call fail wonky exception when forgot dispose old bitmap.

windows restricts how large view on mmf can be, in other words amount of data in file can directly addressed, documented in this msdn article:

the size of file mapping object backed named file limited disk space. size of file view limited largest available contiguous block of unreserved virtual memory. @ 2 gb minus virtual memory reserved process.

"largest available continuous block" restriction in 32-bit process, tends hover around ~600 mb, give or take. 2 gb limit kicks in on 64-bit process. technically gdi+ bypass limit remapping view. doesn't, lockbits() method (also heavily used internally) inefficient , awkward use.

to use larger bitmaps need move successor of gdi+, wic (windows imaging component). exposed in .net through system.windows.media.imaging namespace.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -