Batch Resize Images in Terminal


I Always resized images in Photoshop by creating an action and then have it run through the images, BORRRRING. It would take forever to do this and just take up time. So I wanted an app that could do it, and there isn’t any free ones or ones that I could google quickly. So I went down the smush.it way, but I didn’t want to upload every image to yahoo. I have about 36 gigs worth of images to resize. So I used the google and found mogrify which is a command line tool for using imagemagick.

So if you are on OS X:

brew install imagemagick

Which will install imagemagick for you.

Then navigate to the folder that you want to batch resize images, and this does it recursively so be careful there is no going back. Do this on a text folder just in case. This will resize all the images in the folder to a width of 980. This will only make images bigger than 980 width smaller. If there are smaller images, say a thumbnail image, it will not make them bigger.

find ./ -name "*.jpg" -exec mogrify -resize 980">" {} \;

If you have a lot of images you will need to change jpg to jpeg and then png and maybe JPG, JPEG and then PNG.