title: What is the maximum resolution of C# .NET Bitmap?
body: <p>Theoretically, it should be 65,535 x 65,535 given you have enough memory, about 17GB.</p>
  
  <p>However, creating a .NET 4.5 Console Application to test it out, it throws System.ArgumentException: Parameter is not valid.</p>
  
  <p>The application is built for 64bit platform. Running on 64bit platform with 32GB of memory. Maximum resolution I've been able to get is 22,000 x 22,000 pixels.</p>
  
  <p>I could not find any documentation on this.</p>
  
  <p>And odd behavior is that even at 22,000 x 22,000 pixels, it doesn't always work. It sometimes works, and it sometimes throws the exception. This make me think it's related to contiguous memory allocation, but there is about 30GB of free memory.</p>
  
  <p>Does anybody have any experience with this? And if I wanted to work with say, 100,000 x 100,000 pixel image and larger, what would be the best way besides implementing my own bitmap?</p>
  
  <p>EDIT: The problem isn't .NET Maximum Object Size. This can be overcome by targeting for 64bit platforms, and setting the gcAllowVeryLargeObjects flag in the application config. In this way, I can get the application to consume over 15GB of memory with a single array of integers. So far, the answer seems to lie in the underlying implementation of the GDI+, but how do I get around it?</p>