Photo orientation – understanding and fixing EXIF issues

If you have ever found a photo from your camera oriented the wrong way, you have probably fallen afoul of software that doesn’t handle EXIF data correctly. I had some issues with photo orientation for a while, but it became a real pain when I started uploading photos to this blog.

Something is wrong with the second picture

Windows Explorer seems to think it looks right…
Nope, it’s not correct when uploaded

How it goes wrong
Microsoft’s “Windows Picture and Fax Viewer” was the root of my problem. It isn’t smart enough to read the orientation flag and show the picture correctly (even the version in Windows 7, I’ve read). It just always assumes the same orientation and throws the picture up on the screen. So, when I scan through photos and see one that’s sideways (since I turned the camera to take it), I click the rotate button and all seems swell.

Unfortunately, all is not swell. Picture viewer rotated the pixels, but left the flag that it didn’t understand. Now, picture viewer looks correct but any photo application that properly reads the flag will still try to perform the rotation, and things again look wrong.

This problem became a pain when I was uploading pictures for this blog, so I went ahead and researched it.

Here’s a good explanation of orientation, with much more detail than I could :
http://www.impulseadventure.com/photo/exif-orientation.html

Ok, now that you’re caught up on what EXIF is, what do you do? You have a few options:
Use software that normalizes the photos as you pull them off of the camera
View the photos in software that’s smart enough to respect the EXIF orientation flag
Rotate the photos in Microsoft picture viewer, then fix the EXIF flag

Obviously the last option is the hard way, but that’s the route I took before I figured out what was going on. It’s good to have tools to fix that last one if you have any photos that you’ve already rotated (my last few years of photos) or that you acquired from somewhere else and need to fix.

Option 1: Use software that normalizes the photos as you pull them off of the camera
There are paid options, and Canon cameras come with software that can do this. Unfortunately, I don’t really like that software as much as the simple and clean interface for the Microsoft camera wizard that will pull the photos off and rename them. I’ll need to do more research before I can say for sure that this option works well for me.

Option 2: View the photos in software that’s smart enough to respect the EXIF orientation flag
It baffles me that Microsoft hasn’t figure out that EXIF is an industry standard. While I like using picture viewer, I didn’t realize that I was not doing good things to my picture collection by “fixing” the rotated pictures. Sure, picture viewer now shows the pictures correctly. You just won’t have as much luck with all software.

There are many options, but one of my favorites is irFanView. Check it out at http://www.irfanview.com/. This viewer has been around for many years and is feature-rich, as well as stable. You may want to check out all the features it has, but you don’t need to do so to get started. Check it out, and if you really like it you can tell windows to use irFanView instead of the picture and fax viewer for photos.

Note: my irFanView already handled orientation correctly, but the exif-orientation link above indicated that you have to set a preference to make it work that way. I think newer versions might enable that flag by default.

Option 3: Rotate the photos in Microsoft picture viewer, then fix the EXIF flag
I wouldn’t recommend rotating the photos in the Microsoft picture viewer, but just in case you have already done so (or have a picture that received similar treatment), don’t worry. The picture can be saved, and quite easily. There are several EXIF editors out there, but not all of them are compatible with all systems (or even have write capability without paying). I found “EXIFeditor” and was able to get it to work.

UPDATE 2014-1-16: it looks like the site went down, so you’ll have to find the software elsewhere or find a different program.

Find the software here:
www.kiwiczech.net/index.php?menu=353⊂=4

However, note the lack of support from the developer:
www.kiwiczech.net/phorum/read.php?8,692

I had the unhandled exception mentioned in that thread, and to fix it I needed to rebuild my font cache. You should be able to find some links on Google if you run into the same problem, or if you post to this page I can share more details on that. Despite that software not being supported anymore, it fits my needs just fine.

On to the fix:
Open EXIFeditor and open the jpeg in question.
On the drop-down, scroll down to “Orientation”. Note that it won’t be there unless the photo has set a value for orientation. If it has been set, it is likely something other than 1.
Change the value to 1
Click “commit changes”.

Now check your photo will look the same in picture viewer and irFanView, as well as blogger (or other web services). I performed this fix on photos that looked upright in picture viewer but not other software, so now it looks correct everywhere.

Conclusion:
I wouldn’t recommend manually rotating every photo in the Windows Picture and Fax viewer and then fixing it in EXIFeditor. That would be a bit tedious. However, if you need a quick fix, it’s good to have the tools. The long term solution would be to never rotate photos in software that doesn’t understand EXIF. Not viewing photos in such software goes a long way to removing the temptation to do so.

Posted in photo permalink

About ProjectJourneyman

I am a software engineer that escaped the cubicle world at a large company to go solo with Android app development. My attention to detail and quality applies both to my apps and to my research on how to make money with Android. Now that I have the freedom to work on my own projects, I am documenting my efforts in the hopes that it will help other current or aspiring independent Android developers get the income they desire.

Comments

Photo orientation – understanding and fixing EXIF issues — 3 Comments

  1. The problem goes deeper than Microsoft’s “Windows Picture and Fax Viewer” Just looking at the thumbnails in Windows Explorer – at least for me (Vista) shows the wrong orientation! In my opinion, this is inexcusable, as it makes more required work for me to do just to work around what should be trivially implemented in WE.

  2. Got an email from Anton, suggesting:

    XN View Classic
    http://www.xnview.com/en/

    Browse a folder. Sort by EXIF orientation (icon over images also confirm this). Multi-select, right click > JPEG lossless translations > Rotate based on EXIF value.

    You can turn off the auto .xnbak file creation with Tools > Option > General > File Operations [tab] > For lossless operation, make a backup (untick).