Re: large bitmaps for printing (GDI+)

From: Bob Powell [MVP] (bob_at__spamkiller_bobpowell.net)
Date: 01/12/05


Date: Wed, 12 Jan 2005 08:18:33 +0100

None of the 16 bpp image formats work under GDI+. They are essentially
broken and were included in the system in error.

CAD drawings to plotters are usually defined in a vector graphics format
such as HP plotter format. These formats do not require gigabytes of storage
for even the most complex drawings.

If you have the possibility of breaking the drawing up into smaller chunks
then I think this is the only way that you're likely to have much success.

-- 
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"semhelp" <semhelp@discussions.microsoft.com> wrote in message 
news:95F426C5-DA50-41C3-AEF6-5739D3B90961@microsoft.com...
> Thanks for the response--but I have a couple of questions:
>
> I'm not 'loading' an image from disk.  I allocate a 16bpp bitmap and then
> draw to it.  Are you saying that at some point, it is stored at 32bpp
> internally?
>
> To generalize my original question a little--How do you print a CAD 
> drawing
> to postscript plotters (large page size) at good resolution without using
> many gigs of memory?
>
> I'm trying to print a bitmap image because there appears to be problem 
> when
> sending metafile data with transparency to postscript printers.  I have
> shapes drawn with different hatch brushes on different layers.  If I use 
> the
> standard printing approach (drawing to e.graphics in the printdocument
> routine) the transparency doesn't work.  Microsoft has documented this 
> issue
> and recommends printing as an bitmap image.
>
> So I'm drawing to a bitmap and then using e.graphics.drawimageunscaled in
> the printdocument routine to print.  As you point out, this uses a lot of
> memory as the bitmaps get larger.
>
> Will it help if I draw 1/4th of the image to a quarter size bitmap and 
> then
> call e.graphics.drawimageunscaled to draw the image in the upper left 
> corner
> and then draw another 1/4th of the image to the bitmap and call
> e.graphics.drawimageunscaled to draw the image in the upper right corner,
> etc.  This way, I'm not allocating as large of a bitmap, but I'm not sure
> about how the printing object allocates memory.
>
> I don't have the luxury of a many gigibyte machine either--I just want a
> good resolution plot.  Any ideas?
>
>
> "Bob Powell [MVP]" wrote:
>
>> An image of this size is 1.6 gigabytes in size. There is no way to use 
>> such
>> an image in a compressed form. When images are loaded they are expanded 
>> to
>> their full 32 bpp size when they are first used.
>>
>> You'd need a machine with at least 3 gigs of hard memory on board to even
>> think about printing this. 5 might be better.
>>
>> AFAIK there are no numerical limits other than the size of the integer
>> values for the dimensions of a bitmap. the problems soon arise however 
>> when
>> bitmap size approaches available memory size.
>>
>> I've never had the luxury of an n gigabyte computer system to test such
>> things.
>>
>> -- 
>> Bob Powell [MVP]
>> Visual C#, System.Drawing
>>
>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>> http://www.bobpowell.net/tipstricks.htm
>>
>> Answer those GDI+ questions with the GDI+ FAQ
>> http://www.bobpowell.net/faqmain.htm
>>
>> All new articles provide code in C# and VB.NET.
>> Subscribe to the RSS feeds provided and never miss a new article.
>>
>>
>>
>>
>>
>> "semhelp" <semhelp@discussions.microsoft.com> wrote in message
>> news:8323693A-1FE9-41E2-A67E-7DE5E8D0F56E@microsoft.com...
>> >I need to draw a bitmap from CAD data and then print it in color (at 
>> >least
>> >16
>> > bits) at 600DPI to a large page.  The resulting bitmap can be as large 
>> > as
>> > 20000 x 20000 pixels.  What is the best way to work with these large
>> > images?
>> > Is there some way to work with them in a compressed format?  If you 
>> > have
>> > an
>> > image in .png format, can you draw to it with standard graphics methods
>> > while
>> > the image is still compressed?
>> >
>>
>>
>> 


Relevant Pages

  • Re: The story: Painting bitmap to screen is slow
    ... The general "trick" behind great GDI+ performance is to do all drawing ... single bitmap to the screen. ... I heard Microsoft broke GDI acceleration for some operations in Vista. ... your configuration of Vista or graphics driver. ...
    (microsoft.public.dotnet.framework.drawing)
  • The story: Painting bitmap to screen is slow
    ... I've done a lot graphics programming by now and the thing that bothers me with GDI+ in .NET framework the most is slow drawing of bitmaps to screen. ... In Win32, there were two types of bitmaps, compatible and memory bitmap. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: GDI+ very slow
    ... DrawImageUnscaled when using the correct bitmap format. ... because GDI uses hardware acceleration. ... For double buffering look for the ... but very fast when drawing on a back buffer (a memory ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: GDI+ very slow
    ... DrawImageUnscaled when using the correct bitmap format. ... because GDI uses hardware acceleration. ... For double buffering look for the ... but very fast when drawing on a back buffer (a memory ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Screen display format
    ... memory pointer, then use a compatible bitmap. ... depending on the pixel format of the dib created. ... Windows CE GDI Test ...
    (microsoft.public.pocketpc.developer)

Loading