Monday, October 09, 2006

"Compressible Bitmap Using In-Memory Image Compressing Technique"

The Code Project - Compressible Bitmap Using In-Memory Image Compressing Technique

"The System.Drawing.Bitmap really provides a convenient way for us to create, save, process pictures of many types. However there is one problem with this class that may not be noticed by many programmers, that is it takes a lot of memory resources. For a non-indexed RGB picture of size 1280 by 1024, it will take up 1280 * 1024 * 3 = 3,932,160 = about 4 MB memory. Not so scary, since you have 1G memory on your work station? What if you somehow have to load a thousand picture of that size into memory at the same time? It will eat up all your physical memory plus virtual memory and then still complains you don't have enough memory. I'm sure it's not an imaginary scenario because I encountered the exact problem while writing my application. And I'm sure someone would ask: "why would you want to load so many pictures into memory? you can always load them when they are needed." Unfortunately this doesn't work because loading from disk is too expensive for my application to afford. So I came up with this compromising solution, which takes less loading time than loading form disk and takes less memory than storing the plain BITMAP (with the capital BITMAP, I mean the one that stores RGB values in memory).

..."

This is interesting and an idea/concept I might be able to use.

No comments: