Archive for April 3rd, 2012

April 3, 2012

Crooked Perspective

I have discovered a not cool interaction between my blogging software (wordpress), smart phone (iPhone) and camera (Nikon DSLR).

The Nikon, like most cameras, has an internal leveler, and can tell which way the camera is oriented to take a portrait rather than a landscape image. Along with other bits of metadata, the camera sets an orientation flag for each image. Think of the metadata as additional information about the file. The actual data in the image file, however, is still stored as a landscape, since that is what the image sensor ‘sees’. It’s like if you tilt your head and look at a glass of water. The glass appears like it’s on its side to you, but in your mind you know your head is tilted, not the glass, which is why the water isn’t spilling out.

My computer, as do most computers, renders the image according to the data in the image file. As a result, the image appears as a landscape, regardless of how the camera was oriented. I then use image editing software to rotate the image (effectively re-arranging the pixel data). The orientation flag in the metadata remains unchanged. WordPress also ignores the orientation flag. So the uploaded image appears on my blog the same way it appears on my computer.

The iPhone, however, tries to be smart. Since the orientation flag is still set, it assumes the image needs to be rotated again to display correctly. As a result, the image appears rotated an extra 90 degrees on my iPhone. But only on the iPhone, so I didn’t discover the problem until recently!

The only way to fix it is to strip the metadata so the orientation flag isn’t set, but that means going back over all my past entries and uploading a new photo for all the crooked ones. Not Cool.

To be honest, I’m surprised there isn’t an easier way to strip the image metadata. Aside from the orientation issue, metadata can include GPS location information. It’s handy for figuring out what your photos are of years after the fact, but if you upload an image with geographical information, someone can figure out where you’ve been. You can view the geolocation data in images online for yourself.

Metadata does have it’s uses. Some photographers like to store copyright information in the metadata. Camera manufactures and image processing software also like to add their mark to the metadata, as a form of free advertising for anyone looking to see how an image was created. For me, though, I wish there was an easy way to get ride of it.

Edited to add: There is an easy way to bulk strip meta data!. If your using wordpress installed on a unix server:

>cd wp-content/uploads
>exiftool -all= */*/*.jpg

The ‘*’ character is a wild card. The first * matches all the year directories (2011, 2012, etc), the second * matches the months (01, 02, *) and the third star matches the name of the file.