DEV Community

Cover image for Easily Resize Multiple Images Quickly Through the Terminal on Your Mac
Kyra
Kyra

Posted on • Edited on • Originally published at simplykyra.com

Easily Resize Multiple Images Quickly Through the Terminal on Your Mac

I just wanted to start out by saying that this is an abridged version of my original published version from January 27, 2021 that you can find on my website here.


Resizing and Compressing Images Using Preview on My Mac…. a.k.a. Now the Old Way

When I first started resizing images on my Mac I had been using Preview to view and crop my images so naturally I simply went into Tools and selected Adjust Size to open a new popup window, choose the new size, pressed OK, and voila it was adjusted!

Image show the "adjust size" popup with the highlighted dimensions.

This was great but time consuming especially when combined with needing to export it and manually guesstimate what the quality level should be on the slider. The annoyance was multiplied even more with each additional photo I had as this was an individual process... unless I was missing something with Preview so feel free to comment for someone else.

When exporting you had to drag the slider and see the estimated file size that sometimes didn't update for me.

ImageMagick®… a.k.a. My New Quicker Way

I want to start by saying I still use Preview on my Mac to go through my images before using ImageMagick®. The full iterative process of this is on my website in my original post so I'll jump ahead and share my final command in this image with captions:

Written out command with captions explaining each part

The above command uses the ImageMagick’s magick mogrify to take all of the JPEGs in the current directory and create a resized and compressed copy in the output directory. You can change which image file types are resized and compressed with that last parameter.

I then realized I sometimes use mixed file types so after making a mega command I then simplified it back down to this one which finds the files by name rather than type:

mogrify -path output -resize 750 -quality 100% -define jpeg:extent=70KB IMG_*

And there you go! So much quicker than only using Preview... plus I found away to use montage to create a collage. I show that and the entire process of discovery at my SimplyKyra website where this original and longer published version from January 27, 2021 lives.

Have a great day!

Top comments (0)