How do I generate a jpg file from Flash

I’m interested in generating a customisable wallpaper from flash. Graphics element which could allow the end user to drag and drop, resize and generated into a jpg files for use as wallpaper or other purpose. I am curious to know how I could get flash to generated a jpg file. Would you have any clues or advice to how this could be done?

Below is a link I have found which samples what I am looking into.
please click on the wallpaper creator button from the bottom right.
http://www.garfieldmovie.com/main.html

Many Thanks and any help is much appreciated.