An alternate way to rotate photos

Wed, Nov 29, 2006

So TuxGirl and I got into a bit of a discussion the other day about rotating images. In her post, she found a cool tool called Exifautotran, which is a cool way to rotate images easily, and I am sure it has a few other cool features. I’ll admit, I’ve never used it myself, because ImageMagick does everything for me, and so I commented on her blog and told her so….

Me: Did you also know that ImageMagick can rotate your images? I believe it’s the ‘convert’ tool as I’ve rotated many images with it. In fact, at one time I wrote a very nice script that would detect the rotation, then rotate accordingly. Clint

TuxGirl: Clint: that was what I was planning on using to do the rotation, but I wanted something that would automatically detect whether the image needed to be rotated. I didn’t see that option available in ImageMagick, although it’s possible that I just missed it.

In fact, it would be easily missed if I hadn’t taken the time a few months back to figure it out. It’s as simple as Exifautotran, but as we all should know ImageMagick has many features we’ve grown to love. Here is the simple command I ran to rotate a photo from my digital camera.

$ convert -auto-orient IMG_1860.JPG IMG_1860a.JPG

Pretty easy if you ask me. I do have to admit that it’s simple enough to run Exifautotran to perform this function on a bunch of images in one directory and automatically rotate them. That’s definitely cool, and now you have two choices for your rotating needs.