DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 3 Aug 2007 23:52:38 +0200,    posted on: microsoft.public.dotnet.framework.drawing        back       

Thread Index
  1    Kristijan Marin
          2    Bob Powell [MVP]


Image load throws Out of memory or performance issue   
Hi,

I'm working on a project where we can/ (customer will) load a lot of pages 
at once .....

What we are loading is pages from a newspaper ,,, so there can be like 40 or 
more .....

Now the resolution is 3500x5500 and 300dpi .......

At some point not sure at which image, but when the RAM gets to 1.3 - 1.5 
Gb, I get Out of memory.

So we thought 2Gb RAM will solve the problem but I was wrong..... Windows 
always throw Out of memory at cca 1.3-1.5Gb...

I'm using .NET 2.0 .....

Another problem is the performance in our second part of the project .....

we create reports for some articles that are out or the newspapers for the 
customers .....

the report can contain 10, 40, 60 articles ..... and each article in report 
has the images form the original page, so we need to cut the
parts from the newspaper page and put it into the report ....

Generating report for 44 artocles , total of   62 pages takes 70seconds ....

What we could find out is that without loading the images.... i takes 12 
seconds ..... but cutting them out takes 7 times more

The code bellow shows the cutting code .... Cause the image is  in 300dpi, I 
first reduce it to 100 to save on report file space
then the cutting is made and drawen on the original Graphics that is 
m_graphics ......

Anyone knows what shell i do or change, cause i can't cache the images, 
...... usually one article can have one or more images ....

the problem code is :

Bitmap img2 = new Bitmap((int)WIDTH, 
(int)HEIGHT,PixelFormat.Format16bppRgb555);
img2.SetResolution(100, 100);

using (Graphics g = Graphics.FromImage(img2))
{

g.InterpolationMode = 
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(img, new Rectangle(0, 0, (int)WIDTH, (int)HEIGHT), rec.Left, 
rec.Top, rec.Width, rec.Height, GraphicsUnit.Pixel);


}

m_graphics.InterpolationMode = 
System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

rrr.Location = new Point(rrr.Left + diffX, rrr.Top + diffY);

m_graphics.DrawImage(img2, rrr);

img2.Dispose();


Thanks for the help or ideas ....
/Kris
Date:Fri, 3 Aug 2007 23:52:38 +0200   Author:  

Re: Image load throws Out of memory or performance issue   
Images of that size are not practical to load or manipulate with GDI+.

-- 
-- 
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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.


"Kristijan Marin"  wrote in message 
news:e40qdih1HHA.4428@TK2MSFTNGP03.phx.gbl...

> Hi,
>
> I'm working on a project where we can/ (customer will) load a lot of pages 
> at once .....
>
> What we are loading is pages from a newspaper ,,, so there can be like 40 
> or more .....
>
> Now the resolution is 3500x5500 and 300dpi .......
>
> At some point not sure at which image, but when the RAM gets to 1.3 - 1.5 
> Gb, I get Out of memory.
>
> So we thought 2Gb RAM will solve the problem but I was wrong..... Windows 
> always throw Out of memory at cca 1.3-1.5Gb...
>
> I'm using .NET 2.0 .....
>
> Another problem is the performance in our second part of the project .....
>
> we create reports for some articles that are out or the newspapers for the 
> customers .....
>
> the report can contain 10, 40, 60 articles ..... and each article in 
> report has the images form the original page, so we need to cut the
> parts from the newspaper page and put it into the report ....
>
> Generating report for 44 artocles , total of   62 pages takes 70seconds 
> ....
>
> What we could find out is that without loading the images.... i takes 12 
> seconds ..... but cutting them out takes 7 times more
>
> The code bellow shows the cutting code .... Cause the image is  in 300dpi, 
> I first reduce it to 100 to save on report file space
> then the cutting is made and drawen on the original Graphics that is 
> m_graphics ......
>
> Anyone knows what shell i do or change, cause i can't cache the images, 
> ..... usually one article can have one or more images ....
>
> the problem code is :
>
> Bitmap img2 = new Bitmap((int)WIDTH, 
> (int)HEIGHT,PixelFormat.Format16bppRgb555);
> img2.SetResolution(100, 100);
>
> using (Graphics g = Graphics.FromImage(img2))
> {
>
> g.InterpolationMode = 
> System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
> g.DrawImage(img, new Rectangle(0, 0, (int)WIDTH, (int)HEIGHT), rec.Left, 
> rec.Top, rec.Width, rec.Height, GraphicsUnit.Pixel);
>
>
> }
>
> m_graphics.InterpolationMode = 
> System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
>
> rrr.Location = new Point(rrr.Left + diffX, rrr.Top + diffY);
>
> m_graphics.DrawImage(img2, rrr);
>
> img2.Dispose();
>
>
> Thanks for the help or ideas ....
> /Kris
>
>
> 
Date:Sat, 4 Aug 2007 13:31:24 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us