Graphics.DrawImage() throws out of memory


  • We have got error as following.

    System.OutOfMemoryException: Out of memory.
       at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
       at System.Drawing.Graphics.DrawImage(Image image, Int32 x, Int32 y)
       at System.Drawing.Graphics.DrawImageUnscaled(Image image, Int32 x, Int32 y)

    This Error is throwing even the physical memory is available. We have disposed the objects too.

    Is there any solutions to fix this issue?

    Thursday, June 25, 2009 1:41 PM

All replies

  • The GDI+ error descriptions are not very specific.  Post the relavent code and the size of the images.
    Thursday, June 25, 2009 2:39 PM
  • Hi John,
    Thanks for the reply.
    Basically we are handling multipage tiff files.
    Each and every tiff file may vary in width and size and we are copying the images from one location to another after doing some business logics like adding rectangles/ circles in the runtime and converting the final colored tiff images to black and white. In single hit we are copying more than 100 image using loop.

    Is there any solution to over come this situation or am I doing any thing wrong?

    Friday, June 26, 2009 4:11 AM