/ MACOS

Batch Rotating Images on macOS

Need to rotate a bunch of images on macOS but don’t want to use Preview? Here’s how to do it in Terminal using native tools.

When Things Go Sideways

Once in a while me, my phone, or the both of us get the orientation wrong. Horizontal becomes portrait. Portrait becomes horizontal. Normal becomes upside down. And everything becomes a mess. With the result looking something like this.

Sideways Image of Landscape

Not really ideal. Or something I’d readily put up on my photo gallery. Simply because I don’t want to be liable for twisted necks or broken screens.

Rotating a mobile device is cool. Rotating people or monitors isn’t.

Not too long ago, I came home from a lengthier trip realising that all my photos were taken in landscape mode. Even the ones I had taken in portrait mode. Not cool.

Rotating Images in Preview

Luckily, changing the orientation of an image is fairly easy on macOS. The native Preview app can rotate images with a single button click.

Even better, there are also keyboard shortcuts if you fancy; Command ⌘ + R rotates an image 90 degrees clockwise and Command ⌘ + L rotates an image 90 degrees counterclockwise. Pretty much what you’d expect when you want to rotate images Right or Left.

But, then you still need to open up all images in Preview first, before you can rotate them. Depending on the size and number of the images, this can eat significantly into your available memory. And may slow other things down. For a simple task like rotating a bunch of pictures.

Rotating Images in Terminal

Now, Preview comes with a shiny graphical user interface but what if you have loads of images to rotate (I once had hundreds) or I just prefer plain text in Terminal because

All you really need is Bash!

Luckily, macOS already comes with everything you need pre-installed. And it’s called sips (short for scriptable image processing system). The above photo sideways.jpg can be rotated by 90 degrees counterclockwise with the help of sips via

sips -r -90 sideways.jpg

resulting in the below photo

Correctly Rotated Image of Landscape

Now, that’s more like it! And a great candidate to go up on the photo gallery. Which it eventually did.

The native sips application is a great little image manipulation tool; man sips for all your immediate questions — a search engine of your choice for the rest. Try it out!

So, How Do You Rotate Images?!

While the above works for me when it comes to rotating images in Terminal, you may use an alternative or better way.

Think this is all rubbish, incomplete, or massively overcomplicated?! Feel free to reach out to me on LinkedIn and teach me something new!

As always, prove me wrong and I’ll buy you a pint!

dominic

Dominic Dumrauf

A Cloud Success Champion by profession, an avid outdoor enthusiast by heart, and a passionate barista by choice. Still hunting that elusive perfect espresso.

Read More