This is a good tutorial.

http://www.marksandel.com/PicResize.pdf