473,324 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Graphics.DrawImage consuming more memory ???

Hi,

I am trying to create a image object out of a bitmap file like
Image img = new Bitmap(@"c-\CurDisplayImage.bmp"); ,I found the memory
of the process is increased twice as the bitmap size , for example if I
load a 50MB bitmap the memory is increased by 100MB ,
Also when I draw the image with e.Graphics.DrawImage ,the Peak memory
is reaching to several hundred MB , so when I am dealing with some high
resolution image I am often getting out of memory exception . Any way
to solve this issue ??

Thanks in Advance

Regards
Aravind.

Nov 17 '05 #1
1 4857
Aravind,

My guess is that when you load the image into memory, GDI+ is allocating
the memory it needs to store the image. Then, when you start to draw to the
image, it creates a new image buffer of the same size (hence the doubling of
the memory).

There isn't much you could do here, unless you can break the image down
into smaller images and process those. Either that, or get more memory.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Aravind" <ar*************@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,

I am trying to create a image object out of a bitmap file like
Image img = new Bitmap(@"c-\CurDisplayImage.bmp"); ,I found the memory
of the process is increased twice as the bitmap size , for example if I
load a 50MB bitmap the memory is increased by 100MB ,
Also when I draw the image with e.Graphics.DrawImage ,the Peak memory
is reaching to several hundred MB , so when I am dealing with some high
resolution image I am often getting out of memory exception . Any way
to solve this issue ??

Thanks in Advance

Regards
Aravind.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jeroen Ceuppens | last post by:
Hi, When i do this in my programma, in the contstructor of the form: g.DrawImage(i,new Rectangle(0,0,i.Width,i.Height),0,0,i.Width,i.Height,GraphicsUnit.Pixel); it doens't paint it ;( but if...
8
by: Mark Johnson | last post by:
Using: VS 2003 NET C# for Framework and Framework Compact Trying : Moving a Card (Bitmap) as in Solitare (PC + WinCe) Version on OnMouseMove Problem : The affected drawing Area by Invalidate (or...
4
by: Darren Clark | last post by:
I am trying to simply embed a opaque image over another image... if i use a windows form it works.. e.g. Graphics g = this.pictureBox1.CreateGraphics(); g.Clear(this.BackColor);
3
by: Cesar Ronchese | last post by:
Hey! I'm printing some stuff in a memory-created bitmap (format Imaging.PixelFormat.Format16bppRgb565) and, at the end, copying the bitmap to graphic device of my UserControl. I noticed that...
2
by: Tamer Abdalla via DotNetMonster.com | last post by:
Hello, everyone! I DO need some help in order to understand how to create graphics in VB.NET. I'm a little bit confused... I once knew a time when using Point & PSet was almost the only way to...
1
by: jake | last post by:
When I draw (using DrawString() and other Draw...() methods) directly to the PrintDocument using the PrintDocument's PrintPageEventArgs e, the print-out comes out nice and sharp. But when I direct...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
9
by: DaveL | last post by:
hello I have a Bit map 1367 wide 32 high this bitmap contains like 40 separate Images 32x32 I tell it the id*32 to get the approiate Image from the source Bitmap When i CreateGraphics()...
2
by: drsmooth | last post by:
Hi, i have made several different things using a double buffer and a jframe before but never had this problem: if you look thrugh the code, you can see that i draw a whole bunch of stuff to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.