title: Getting out of memory exception when loading high resolution image with IImagingFactory
body: <p>I am trying to load high resolution image(like 3264x2448). For that I am using IImageFactory class in C#. IImageFactory is downloaded from the Microsoft site. If I try to load the high resolution image I am getting “out of memory” exception. Have a look at the below sample:</p>
  
  <pre><code>IImage GetIImage(string fileName)
  {
  
  Bitmap bitmap = null;
  
  Graphics graphics = null;
  IntPtr hdcDestination = IntPtr.Zero;   
  try    {
      IImage image = null;
      IImagingFactory imagingFactory = ImagingFactory.GetImaging();
      imagingFactory.CreateImageFromFile(fileName, out image);
      bitmap = new Bitmap(width, height);
      graphics = Graphics.FromImage(bitmap);
      hdcDestination = graphics.GetHdc();
             Rectangle dstRect = new Rectangle(0, 0, width, height);
     image.Draw(_graphicsHDC, ref dstRect, IntPtr.Zero);
  }
  catch{}
  }
  </code></pre>
  
  <p>Using  the above source lines I was able to load the images but my effort to draw image fails, throwing an OutOfMemory Excep :( 
  Further, I tried the same by creating a Win32 mobile App, in which I could bot Load and Draw the desired images with the following lines.</p>
  
  <pre><code>void DrawImage(HDC *hdc, char *FileName, int width, int height)
  {
  IImagingFactory *pImgFactory = NULL;
  IImage *pImage = NULL;
  RECT rc = { 0, 0, width, height};
  
  WCHAR Name[MAX_PATH] ={0}; 
  mbstowcs (Name, FileName, strlen (FileName));
  CoInitializeEx(NULL, COINIT_MULTITHREADED);
  if (SUCCEEDED(CoCreateInstance (CLSID_ImagingFactory,
                                  NULL,
                                  CLSCTX_INPROC_SERVER,
                                  IID_IImagingFactory,
                                  (void **)&amp;pImgFactory)))
  {
      // Load the image from the JPG file.
      if (SUCCEEDED(pImgFactory-&gt;CreateImageFromFile(Name, &amp;pImage)))
      {
          pImage-&gt;Draw(*hdc, &amp;rc, NULL);
          pImage-&gt;Release();
      }
  
      pImgFactory-&gt;Release();
  }
  CoUninitialize();}
  </code></pre>
  
  <p>I even tried creating a win32 dll and invoke it from C# app but I couldn't. 
  Can anyone help me out to resolve this issue?</p>