Painting image chews lot of memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

This is following from one of the previous threads. Since it deserves a new thread, so here it is:

JPG images are compressed, but when an image is loaded in an app it needs to
allocate the memory required for the pixel data. For example, I took a
screenshot of my desktop (a 24-bit image at 1400x1050) and saved it as a
jpg, which resulted in a 51KB file. However, when I open it in Paint, the
memory required to keep the image in memory is 3 x 1400 x 1050 = 4.5MB. For
some reason Paint actually ends up using 18MB!!

So, why does Paint use 18MB of memory for a 4.5MB of file? This seems to be a fundamental flaw in .NET framework!!! Simply because when the same file is opened in some other application (e.g. Paint Shop Pro), it does not consume so much memory!! Help please!

Cheers
 
How are you getting your numbers? Task manager is not accurate. I suggest
using google groups for ".net memory usage" to see many great threads about
how memory is used in .NET and Win32.

Also, note that it could easily be represented in 32-bits, so the raw data
needed might be closer to 6MB than 4.5MB.

-mike
MVP
 
Back
Top