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!

I want to know how to make my image wider, by increasing the canvas size, not scaling the image, and the new size where the image did not exist before should then be transparent. How can I do that? With gimp, it is simply changing the dimensions of the canvas.

one more note on my previous comment, actually crop seems to create lots of weird images instead of just one of the middle, so you should use the smallest border possible and only use crop if necessary.