Mac - 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?

Yes, 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 show to how to batch resize images using a Mac GUI tool.

Mac batch image resizing with the ImageMagick mogrify command

Here's an ImageMagick mogrify command I just used 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/Note: Make a backup of your image files before running this command.)

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.

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.

a similar and more comfortable solution

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

Thanks, that might be a good

Thanks, that might be a good idea for a lot of people. I started off that way myself, but switched to using the command shown above when I learned that I could issue it that way. But I can certainly see where this is a more "comfortable", Unix-like approach to the problem.

Post new comment

The content of this field is kept private and will not be shown publicly.