ImageMagick is a really cool product. Not only is it open source but its very powerful tool. My goal was to figure out how to batch resize images while keeping one side 640 pixels wide. I ended up using ImageMagick’s mogrify by issuing the command below at my CentOS shell prompt.

mogrify -resize x640 *.jpg

or

mogrify -resize 640 *.jpg

Depending on which side you want to be 640 pixels. If you would like for image magic to make the largest side 640 and constrain the proportions use the following command.


mogrify -resize 640×640 *.gif

This is just one of ImageMagick’s long list of tools. Below is more information about mogrify from the man page.

mogrify -  resize  an  image,  blur,  crop, despeckle, dither, draw on, flip, join, re-sample, and much more. Mogrify overwrites the original image file, whereas, convert(1) writes to a different image file.

ImageMagick will conert between a huge list of file types which are bmp, cgm, cmyk, eps, fax, fig, fpx, gif, gray, jpeg, pbm, pcd, pcl, pcx, pdf, pict, png, pnm, ppm, ps, rgb, tga, tiff, xbm, xpm, and xwd.

DeliciousStumbleUponDiggTwitterFacebookRedditLinkedInEmail
Tags: , , , , , , , , , , , , , , , ,
2 Responses to “How to Batch Resize Image from Linux Shell with ImageMagick”
  1. Eric says:

    What an amazing tool. This is great article on getting started with this ImageMagick. I never heard of this tool until I found your article and am blow away on how nice this is. Thank you!

    [Reply]

    alex Reply:

    Hello Eric,

    No problem. Thanks for taking the time to leave feedback. ImageMagick really is awesome and is a powerful tool to have in your arsenal when manipulating images.

    Thanks.
    alex

    [Reply]

  2.  
Leave a Reply

*Type the letter/number combination in the abvoe field before clicking submit.

*