MacOS: How to batch-resize images with the ImageMagick mogrify command

Mac batch image resizing FAQ: Is there a built-in Mac OS X command I can use to batch resize images and photos on my Mac OS X  computer?

This article shows a “Mac batch image resize” approach you can use from the Mac Terminal command line, and in the link I share below I also show to how to batch resize images using a Mac GUI tool.

Mac batch image resizing with the ImageMagick mogrify command

If you download ImageMagick, you can use its mogrify command to “batch resize” all “*.png” image files in the current directory to a resolution of 534 pixels by 402 pixels:

mogrify -resize 534x402 "*" *.png

Warning/Notice: Make a backup of your image files before running this command. (Or look into the ImageMagick ‘convert’ command, which leaves the original image unmodified.)

I assumed I'd have to do this using a shell script, i.e., using the script to loop through all the PNG files, but that's not necessary, this one mogrify command does it all.

FWIW, all the image files started at the same resolution, around 800 pixels wide, that's why I chose this same size for all my new image files with this batch image resize command.

Batch resizing with a percentage

If you want to batch resize a group of images by supplying a percentage, you can use a command like this:

mogrify -resize 60% *

That command resizes every image in the current directory to 60% of its original size.

Simple GUI batch image resizing on Mac OS X

If you have a Mac OS X system, there's another way to resize a group of images. See my "Batch resize images on Mac OS X tutorial" for more information.

I wrote a script based on the above post. The script is a little more comfortable:

#!/bin/bash

for i in *.jpg
do

  echo "I am resizing the $i image....."

  # writes to a new file, the old one survives 
  #convert -resize 800x600 $i    

  # writes to the same file, the old one will vanish 
  mogrify -resize 800x600 $i

  echo "Image $i has been resized."  

done

Add new comment

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.