Can't believe I haven't come across convert and mogrify before now. Much time could have been saved in the past.
I used Ubuntu 10.04 Lucid for this, but I doubt it matters much as long as you have a recent Linux distribution.
sudo apt-get install imagemagick
Example: resize an image to fit in a 100x100 pixel box, and place it in the centre of a 100x100 pixel box:
convert foo.png -resize '100x100' \ -background transparent \ -gravity center \ -extent '100x100' \ bar.png
Lots more good documentation here.