Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1443
  • Last Modified:

Is GDI+ able to draw (& print) BIG bitmaps ?

I use GDI+ to draw bitmaps with graphics.DrawImage; it works well for photos, logos, ... but i also have to draw very big images, for example 7000 * 7000 pixels (these are scans from cadaster plans; i work on a cad program for surveyors). DrawImage fails to draw these images & returns an error meaning out of memory. I know that GDI+ uses 4 bytes per pixel (even if it's a monochrome bitmap, GDI+ always works in true color, at least that's what i understood from documentation). So for 7000 * 7000 pixels, 4 * ( 7000 * 7000) = 196 MB are needed. My PC has 1 GB, from which more than 512 MB are available. But GDI+ nevertheless fails to draw the bitmap. Or sometimes it can draw but it fails to print.
  • 2
1 Solution
Both GDI+ and GDI have restriction drawing large image in the screen or printer. You need to make some transformations before drawing.

Try to create memory GDI+ bitmap of small size, copy original image to it with resizing and draw it on the screen.
If this doesn't work, extract bitmap bits to plain memory array, load it to GDI bitmap and draw. If this doesn't work, resize memory array using your own resizing function, load it to GDI+ or GDI bitmap of small size and draw it.
JP_GobletAuthor Commented:
... after discussion with my boss, we are on the merge of giving up gdi+, and starting to evaluate LeadTools library;
we don't have time to try to get round the limitations of gdi+, if it was not designed to draw big bitmaps (7000 * 7000 pixels was just an example, it can be a lot bigger).
so your answer is finally useless to me (anyway what you suggested seems to me to be somewhat complex), but you get the points for your help.
JP_GobletAuthor Commented:
for those interested by this problem, here is an interesting link in msdn forum (similar problem) :


the conclusion from the microsoft guy is that perhaps there is a problem in gdi+, but "currently there is no way to resolve this problem in the current release version of gdiplus.dll."

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now