ImageMagick is a free software package to create, edit, and compose bitmap images. It can read, write, and convert between over 100 different image formats. If you have a large number of photos to process, ImageMagick is the perfect choice with its powerful command-line tools. Here are some examples on how to batch re-size jpeg photos in the current directory using “mogrify”.

Please note, these examples are for the Windows command shell (Start\Run\cmd.exe). ImageMagick is also supported under *nix and Mac OS X. The syntax may be slightly different. To get the example to work, ImageMagick executable needs to be installed in the path. Please refer to the ImageMagick documents for details.

Resize to 640×480 (maximum width and height), keep the aspect ratio

mogrify -resize 640x480 *.jpg

Resize to fixed width of 640, keep the aspect ratio

mogrify -resize 640 *.jpg

Resize to fixed height of 480, keep the aspect ratio

mogrify -resize x480 *.jpg

Resize to exact 640×480, change aspect ratio if necessary

mogrify -resize 640x480! *.jpg

Resize to 50% of original size, keep the aspect ratio

mogrify -resize 50% *.jpg

Resize images that are less than 640 pixel wide to 640px wide (image wider will be ignored)

mogrify -resize 640"<" *.jpg

Resize images that are more than 480 pixel height to 480px height (image image shorter will be ignored)

mogrify -resize x480">" *.jpg

Resize images to no larger than 640×480 (images with width and height less than 640 or 480 will be ignored)

mogrify -resize 640x480">" *.jpg

Resize images to 100K pixels

mogrify -resize 100000 *.jpg

You probably have realized the power of ImageMagick. A friendly warning though: the original file will be overwritten. Please make a backup of the original photos if you want to keep them. You have been warned!

Posted in: Software on September 6th, 2007. Trackback URI
Keywords: , , ,

Related Posts