Mogrify is a command utility part of the imagemagick software http://www.imagemagick.org/script/index.php and is extremely useful for doing batch image conversions – including conditional changes.

eg.

mogrify -resize 200×200\> *.jpg will resize all jpegs in the same folder (using the same file name, so long as the suffix is jpg) so if they are larger than 200×200 in size (but not less than) they are shrunk, BUT MAINTAIN ASPECT RATIO. Useful for making thumbnail images.

More on mogrify command can be found here http://www.imagemagick.org/script/mogrify.php