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.
JP_GobletAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AlexFMCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.
0
JP_GobletAuthor Commented:
for those interested by this problem, here is an interesting link in msdn forum (similar problem) :

http://msdn.microsoft.com/newsgroups/managed/default.aspx?query=gdi%2B+bitmap+cache&dg=microsoft.public.win32.programmer.gdi&cat=en-us-msdnman-windev-winsdk&lang=en&cr=US&pt=&catlist=AB6C31EE-77E8-4E0E-8068-CB7C8258B8CA&dglist=&ptlist=&exp=&sloc=en-us

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."
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.