Novell Home

Batch Resize Images Using Imagemagick

Novell Cool Solutions: Tip
By Michael L. Farrell

Digg This - Slashdot This

Posted: 7 Dec 2005
 

PROBLEM: Suppose you need to do a batch operation on a large set of pictures? Although Gimp is an extremely powerful tool for image editing and processing, it is still very time consuming to do a series of tasks on a large list of images in GIMP without wasting a lot of time.

SOLUTION: The Image Magick graphics suite contains an extensive set of commandline tools which can do fast image processing operations on more than one file at a time. One of the commands included in this suite is "mogrify".

EXAMPLE: "mogrify" can do alot of operations, all documented in its manual page. For the sake of example, I will show how to do a batch resize of all of the jpeg images in the current directory to 320x240.

In the konqueror window containing the images you wish to resize, select "tools->open terminal" to bring up a shell.

In the shell type:

mogrify -resize 320x240 *.jpg

After this command is completed, all of the images will be replaced with resized version of themselves. Notice that in an effort to preserve the image aspect ratio, mogrify may not be produce images that are exactly 320x240. To force this to happen, modify the original command to by placing an exclamation point at the end of the desired resolution:

mogrify -resize 320x240! *.jpg


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell