Converting Images using ImageMagick – convert

Offlate I am uploading lot of images to my blog.  Normal images from digital camera contain lot of information like camera details, flash status etc. While putting on web I would like to reduce the size of the file so that it is easy for uploading as well as for viewing. I found convert tool of Image Magick very useful.

convert offers various options like strip, resize etc. The syntax is

convert -options input_image_file  output_image_file

Here is an example

$ convert -strip img_5735.jpg new_img_5735.jpg
$ ls -l
 total 2308
 -rwxr-xr-x 1 ram ram 1252058 2011-10-21 07:30 img_5735.jpg
 -rw-r--r-- 1 ram ram 1098785 2011-10-21 07:31 new_img_5735.jpg

From the above you can see merely stripping the info about the images saves considerable space. If you want to reduce image size  you can use resize option like this

convert -resize 50% img_5735.jpg  reduced_image.jpg

For converting many images I use this simple shell script

for file in `ls *JPG`


convert -strip -resize 50% $file new_$file


convert has several other options, see man convert.

To use convert you should install ImageMagick Package


One Response to Converting Images using ImageMagick – convert

  1. seesiva says:

    Thanks for sharing very useful indeed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: