I second the recommendation of Image Magick. It is absolutely free software. Runs on Windows and UNIX and Mac (and maybe more I don't remember). You can use the supplied programs in a shell script or you can use the library routines from C/Perl/Python (and I think PHP and maybe other language bindings).
I do both shell scripting and Perl.
Really works great. Not only will it convert from e.g. tif to jpeg it will scale as well.
Image Magick
I also use compupic Pro. It has very powerful batch conversion features and does a good job of JPEG. It doesn't do a good enough job of scaling to let it run on its own, I have to sharpen the image afterward.
Compupic Pro