Art.com was just sold/bought for 200 million $$$ to/by Getty last week (2 weeks?).
I'm sure one of the reasons is the ability to frame the photos, and sell "on the spot", so to speak. It's a massive distribution network Getty wanted for his massive stock photo library.
If you are trying to do something similar, it would involve a lot of CGI and Image Manipulation (ImageMagik, GD, etc) to provide a custom graphic frame for the image.
It would also involve a heck of a lot of computer overhead, since you'd be re-generating the image for each 'try.'
Not something you'd want to do for kicks, unless you were making a sale.
JPG images would be degraded by one generation.
I've looked at most scripts out there, and it's hard enough to find a good conversion/thumbnail program, much less one that will automatically frame with a specified graphic. (There is a good one that will matt/shadow/rotate images, but it doesn't span pages or create linked galleries).
You can find most scripts (or pointers to them) at
http://www.cgi-resources.com (IMHO one of the best script/cgi resources on the net!)
If you do happen to find a script that will do it, I'd like to know too

But I'm sure that is a feat of custom programming probably done on an NT box or Windows box by hacking existing image utitilities.
They send the image to a render.asp which helps confirm a windoze environment.
I haven't seen anything on Unix that comes close to what is available for Windoze, but that may change as *nix gains popularity.
BTW ... the stuff Art.com is doing is simple enlarging/filling the canvas behind the image, and basic rendering. For truly remarkable framing software, check out
http://www.corbis.com . They have pretty impressive choices of real frames, and they are using tables to piece them together

*THAT* is a script I'd like to have
Scott