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

Posted on 2005-03-07
Medium Priority
Last Modified: 2013-12-03
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.
Question by:JP_Goblet
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 48

Accepted Solution

AlexFM earned 750 total points
ID: 13475365
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.

Author Comment

ID: 13475696
... 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.

Author Comment

ID: 13475728
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

Percona Live Europe 2017 | Sep 25 - 27, 2017

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question