Imagemagick is an awesome command-line based image manipulation tool.
[Paraphrased from the imagemagick manual:]
ImageMagick®, is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bezier curves. ImageMagick includes a number of command-line utilities for manipulating images. Most of you are probably accustom to editing images one at a time with a graphical user interface (GUI) with such programs as gimp or Photoshop. However, a GUI is not always convenient. Suppose you want to process an image dynamically or you want to apply the same operations to many images or repeat a specific operation at different times to the same or different image. For these types of operations, the command-line image processing utility is appropriate.
To install imagemagick, use Synaptic, or issue the following command in a terminal
sudo aptitude install imagemagick
Visit my post on using Imagemagick to perform the same process on multiple images.
There are many examples on the imagemagick website.