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

x
  • 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.
0
JP_Goblet
Asked:
JP_Goblet
  • 2
1 Solution
 
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
 
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

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