Can definitely be done with ImageMagick or GraphicsMagick - which, although were originally the same software, have now diverged in potentially significant ways.
For example, GM can process images faster, but fails to handle some JPEG images that IM can handle.
There are various IM thumbnail examples here, including adding transparent padding:
http://www.imagemagick.org/Usage/thumbnails/#pad
(Be sure to use 24-bit PNG, not GIF
, for transparency.)
Also, whilst resizing is simple, you may find you want to experiment to find out what produces the best quality - I once ended up with a process that enlarged an image and applied a slight sharpening effect, before shrinking down to intended size - this mostly produced better thumbnails than a straight resize, (except for simple logos where it made things worse so needed to be disabled).