Manage Images with ImageMagick

ImageMagick is a software suite used for image manipulation and display, supporting many image formats. ImageMagick software mainly uses command line interface for image manipulation. You can use this software to do tasks such as rotate, scale, resize, flip, shear, display and many more. You can do the image manipulation job much faster using command line interface and it is easier to use.

Now, I will walk you through the steps to install ImageMagick software suite.

To display the image, use the following command on your terminal:

display filename

For example:

display /home/joe/flower.png

This command will display the flower.png image on your screen.

To resize the image, use the following command on your terminal:

convert -resize WidthXHeight source destination

For example:

convert -resize 200X200 /home/joe/flower.png /home/joe/flower_1.png

This command will resize the image to 200X200 and saves it to flower_1.png.

ImageMagick has a command using which you can change the format of the image. For example, you can change the .jpg image format to .png format. ImageMagick supports over 100 image formats. To convert the format of the image, use the following command on your terminal:

convert source destination

For example:

convert /home/joe/flower.jpg /home/joe/flower.png

This command will change the .jpg image format to .png format.

Using ImageMagick you can animate a particular format of images in a directory. To animate the images in a directory of .png formats, use the following command on your terminal:

animate /home/joe/*.png

ImageMagick software provides much more commands to manipulate and display the images. For more information about ImageMagick commands please visit the web site http://www.imagemagick.org/script/command-line-tools.php

Batch Resize Images in Linux Using Imagemagick

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.

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 320×240.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 320×240 *.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 320×240. To force this to happen, modify the original command to by placing an exclamation point at the end of the desired resolution:

mogrify -resize 320×240! *.jpg

http://www.novell.com/coolsolutions/tip/16524.html


Related Posts

Tags: ,

One Response to “Manage Images with ImageMagick”

  1. kozaki Says:

    Didn’t event know about the “!” option with “mogrify -resize ”
    This will be pretty much usefull to easily correct 4/3 screenshots that are incorrectly saved as 16/9 from TVTime :)

Leave a Reply

You must be logged in to post a comment.