Output to memory instead of file using libjpeg and libpng

I need to use libjpeg and libpng to convert an image from the raw RGB format to JPEG and PNG format and then output the result to a memory buffer, and the following two links saved me lots of coding effort:

http://www.codeguru.com/forum/archive/index.php/t-378333.html

http://stackoverflow.com/questions/1821806/how-to-encode-png-to-buffer-using-libpng

Additionally, there is also a good online tutorial showing how to do in-memory data compression using zlib at
http://www.gamedev.net/reference/articles/article2279.asp

PS: just found out that the latest libjpeg (version 8 ) coming out two weeks ago added the in-memory compression method. Cheers!

Add CentOS Linux guest OS to virtualbox

During my installation of a CentOS Linux guest OS on my Windows XP host system, I found most steps are pretty straightforward according to the manual, but there are a few places costing me some time to do research on Google.

1) To install the guest addition kit, I have to find and mount the image file VBoxGuestAdditions.iso under the virtualbox program root folder, but then I met this error when running “sh VBoxLinuxAdditions-x86.run”:

Guest Additions installation
Please install the build and header files for your current Linux kernel.
The current kernel version is 2.6.18-164.el5
Problems were found which would prevent the Guest Additions from installing.
Please correct these problems and try again.

After trying multiple solutions on Google, the following solution worked for me, i.e, by running:
install kernel-devel-`uname -r`

2) X-windows size is too small, maximumly only 800×600. After adding the guest addition, I am able to either modify the display file “/etc/X11/xorg.conf” under Section “Screen” to add a new Modes “1280×1024”, or directly use the System -> Display tool: under the Hardware tab, select LCD monitor type and then under the Settings tab, choose the right Resolution.