There’s more to the Orientation field than 1, 6, and 8. I call it derotate: #!/bin/bashĮxiftool -Orientation=1 -n nice thing about derotate (which it inherits from exiftool) is that I can invoke it with as many arguments as I want: derotate. I found myself doing this enough that I wrote a one-line shell script to save myself from typing “Orientation” over and over. Doing this to the two portrait images of Dr. Will get stick the value of 1 into the Orientation field, and my computer will now display the images as if the camera had been held in the normal orientation. Instead of having it report the value of the Orientation field, I can have it write the value 1: exiftool -Orientation=1 -n When this inadvertent rotation occurs, I typically want to get rid of the rotation and put the photo in landscape orientation. And that could be any orientation, because I never think about how I’m holding the camera before I’m ready to shoot. I think it reports the orientation the camera was in just before I pointed it down to take the picture. In this position, the orientation device-which presumably uses gravity to figure out which way is up-doesn’t have much to go on, and the value of the Orientation field is kind of a crapshoot. Unfortunately, I happen to take a lot of photographs looking down, with the camera’s image sensor in a nearly horizontal plane. Doom appeared on my computer with the correct orientation because my computer looked at the Orientation field of the EXIF data and rotated the image accordingly.
Which tells the software on the computer to rotate the image data 270° clockwise before displaying it.įinally, if the camera is rotated so its top is pointed to the photographer’s right, the image will look like this on our computerĪnd exiftool will tell us the orientation as Orientation : 6 If the camera is rotated so the top is pointing to the photographer’s left, the image will look like this on our computerĪnd exiftool will tell us the orientation as Orientation : 8 If we leave out the -n option, exiftool will tell us the orientation in English: exiftool -Orientation We can use exiftool to tell us this by executing exiftool -Orientation -n If the camera is in landscape orientation with the bottom of the camera down, the orientation value is 1: The orientation information is expressed as an integer and written to a specific field in the EXIF metadata for the image. Applications that display images read that information and present the image rotated accordingly. With exiftool, I can remove the spurious rotation that sometimes appears, and I know that it’s a lossless operation because exiftool doesn’t touch the image itself, only the metadata.įor a few years now, digital cameras have included a device that tracks the orientation of the camera and puts that information into the image file’s metadata. Enter exiftool, an extremely full-featured program and Perl library for editing the EXIF metadata in image files. Rotating photos is no big deal-I can’t imagine any image editor that won’t let you do it-but I want the rotation to be done losslessly and I want to know it’s being done losslessly. Next post Previous post Derotating JPEGs with exiftoolĪfter importing photos from my digital camera, I often find that pictures I took in landscape mode are rotated to portrait mode.