Fix EXIF info on photos rotated in Windows explorer

HI there, need some quick help.

I've rotated a bunch of photos using Windows 7 explorer (selecting the thumbnails and right-clicking rotate).

A bug here means the EXIF info is not updated right, so the images now show wrong in other programs (eg ipad)

Is there a quick way to fix this (eg 15 mins from reading a working answer)? eg a dos command to bulk update the EXIF info. Several dozen to correct so not a huge one, but if there's a way i can maybe use it as a workaround next time too.

Or do i need to edit them all manually. If so what is the quickest way to do this? I don't mind doing it on ipad, android, or windows, but reluctant to upload to a cloud just yet.

Thanks
xeniumAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

xeniumAuthor Commented:
PS the "quick" way should be automatic, ie the method derives the correct photo orientation based on how the picture shows in Windows explorer thumbnail view. I should not have to specify the correct orientation for each photo (i had already done this in windows explorer)
0
Bill PrewCommented:
Can you post up one photo that has the problem so I can see the EXIF data and how it has been rotated?

~bp
0
xeniumAuthor Commented:
hi Bill, thanks for your response. See attached example jpg which is showing correctly as a thumbnail in Windows 7, but not so in many apps, shown rotated 90 degrees, eg as in example shown in this doc: https://docs.google.com/document/d/1WqYJcmnBaLg2l-amsqfP78bRRn2tLwt-w5P-4_GfWg4

Thanks

example photo whose thumbnail is showing correctly in Windows 7, but wrongly when opened in many apps
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

Bill PrewCommented:
Hmmm, that's a little odd, I downloaded the image you posted here to Windows, and the icon, preview, and viewer all show it "wrong" in portrait orientation in Explorer.

In the Windows viewer I had to rotate it 90 degrees, and it updated the file as expected, but I think it does more than just change some EXIF, I think it recodes and rewrites the image file.

~bp
0
xeniumAuthor Commented:
I also downloaded it (to a new location) and the thumbnail is showing correctly in Windows, but is wrong when opened. So the bug is preserved in passing the image through this webpage.

So I still need an answer.

Thanks
0
xeniumAuthor Commented:
Just in case this is also a variable, I am seeing the image preview above in the correct orientation, but clicking the image opens a new tab with the image with the wrong orientation

http://filedb.experts-exchange.com/incoming/2015/05_w19/912887/50s-2907.JPG

I would expect experts exchange at least to be consistent! Clearly this is not a straightforward issue.
0
xeniumAuthor Commented:
Some more tests on dropbox.. 4 images in this folder , they all show wrong on my Windows thumbnails, and wrong in Windows photo viewer, but 2 of them show correctly on an ipad, or in FS viewer. The other 2 were taken "wrong" deliberately, perhaps to use for further testing.

To break things down:

a) What is the orientation variable used by an ipad or other apps to orientate the image correctly?
b) how i detect if an image has been rotated in Windows?
0
xeniumAuthor Commented:
I'm redoing the job in FSviewer, will post update shortly
0
xeniumAuthor Commented:
Ok have redone the job in FSviewer, now seems to show correctly on Windows and ipad. I will stop using windows and stick to FSviewer.

http://www.faststone.org/FSViewerDetail.htm
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bill PrewCommented:
Glad you have a work around.

~bp
0
BillDLCommented:
Hi xenium

I realise this question is in the process of closing, but I thought I would add some details to try and explain the inconsistencies between Windows, browsers, and image viewing and editing applications.

Most modern digital cameras now have an orientation sensor that detects how the camera was held in relation to the ground.  They write a 0, 1, 3, 6, or 8 value to the EXIF metadata tag named "Orientation".  It would be very unusual to see values of 2, 4, 5, or 7 against this tag, because they are only used where an image is flipped horizontally (mirror image) and presumably would only be written to the image by software that respects and fully supports all the available Orientation values.  I doubt whether a digital camera would flip an image before saving it to the camera's memory, unless it has some cheesey special effects options that might do this.

The common values for the Orientation tag tell supporting software that the camera was held as follows when the photo was taken:
0 = Camera doesn't have an orientation sensor or the feature was disabled
1 = Horizontal/Landscape and upright - normal position.
3 = Horizontal/Landscape but held upside down.
6 = Vertical/Portrait - Turned clockwise by 90 degrees from normal upright position.
8 = Vertical/Portrait - Turned anti-clockwise by 90 degrees from normal upright position.

If ever seen as a value, perhaps after an image editor did some lossless processing and modified the Orientation tag, the following values would have the respective meanings:
2 - Same as 1, but horizontally flipped (ie. on the vertical axis - mirrored).
4 - Same as 3, but horizontally flipped (ie. on the vertical axis - mirrored).
5 - Same as 6, but horizontally flipped (ie. on the vertical axis - mirrored).
7 - Same as 8, but horizontally flipped (ie. on the vertical axis - mirrored).
(I hope I got these correct - I was sitting and doing various contortions with my head to visualise it).

Supporting software should read the value and display the image in the orientation that it was originally taken so that it displays as the photographer intended it to be viewed.

Because there was such a mish-mash of support, partial support, erroneous support, and non-support for the EXIF Orientation tag value, Microsoft decided not to include support for it in their in-built Windows Picture and Fax Viewer (XP) and Windows Photo Viewer (Win7).  Because these are part of Windows Explorer, Windows itself completely ignores the orientation tag.
They have explained their reasoning for non-support under the "More Information" section here:
https://support.microsoft.com/en-us/kb/2001954

Part of their logic does make sense where users have one piece of software that supports it and one that doesn't.  The user can end up with incremental errors if they think an image is wrongly oriented when seeing it in an application that disregards the tag, and they then decide to rotate it.

Some software does a "lossless rotation" by only changing the value of the EXIF tag so that the software now does a virtual rotation to display it that way again.  Other software takes the data from the X and Y axes, physically remaps it all to the new orientation, and re-saves the image with additional unwanted JPG compression.

The Windows Picture and Fax Viewer (XP) and Windows Photo Viewer (Win7) fall into the latter category.  Not only do they re-process and save the image back to itself with additional unwanted compression, but they REMOVE the entire EXIF "Orientation" tag and replace it with several of their own crappy tags, they usually zero out some of the other image metadata values like "ExposureMode" and "WhiteBalance", they will modify the "MakerNote", "UserComment", and some other values, plus possibly other things that I haven't noticed before.

It does tell you the following in a popup information dialog when you click the rotate button in the Windows Picture and Fax Viewer:
"Because of the dimensions of this picture, rotating it might permanently reduce its quality. Rotating a picture automatically saves it using the original name. To save a backup copy first, see 'Copy an image' in Help.  Do you want to proceed? "

Microsoft have been guilty of mangling files in the past.  If you open an image in MS Paint and re-save it as a JPG, you have no control over how much compression is applied, and it always applies more than you would ever have wanted, leaving a fuzzy image with artefacts.

They decided that the MP3 Standard wasn't good enough for them, so they decided to allow Windows Media Player to write unique Microsoft "ID3" tags to MP3 files managed by Media Player.  In addition, Media Player actually mangles or deletes existing compliant ID3 tags that would be used by other media playing software.  You will always find people looking for MP3 Tagging solutions after Windows Media Player messed up the tags in their files.

So, you open an image that was taken by a digital camera held vertically (ie. rotated 90 degrees to the right) in the Windows Explorer viewer.  It disregards the Orientation = 6 EXIF tag and displays it wrongly.  The user rotates it in the program and it deletes the EXIF tag, so the image will now display wrongly in other applications that would have displayed it correctly using virtual rotation.

One of the free programs that supports virtual rotation by reading the EXIF Orientation tag value is IrfanView.  It has a check box to enable or disable auto-rotation.  Options menu > Properties / Settings > JPG/PCD/GIF section > "Auto-rotate image according to EXIF info (if available".  That can provide a quick method of determining whether you are seeing an auto-rotated image.  IrfanView also has a good dialog that shows the EXIF data:  Image menu > Information > "EXIF info" button.  You can also run it from the command line to retrieve data, eg:

i_view32.exe c:\test.jpg /info=c:\test.txt /killmesoftly
i_view32.exe c:\test.jpg /info=c:\jpgs.txt /fullinfo /killmesoftly
i_view32.exe c:\*.jpg /info=c:\jpgs.txt /killmesoftly

The   /fullinfo    switch tells it to get the EXIF, IPTC, and Comment data as well as the standard image info, and   /killmesoftly   just quietly closes IrfanView after execution.  More elaborate batch files can be constructed, for example to find only the EXIF Orientation tag if it exists, and get the value.

Some "downloader" applications that detect when the camera is connected by USB, and act as an intermediary, detect the Orientation value, will display the image thumbnails as they should be viewed, and then losslessly rotate them when saved to a folder by only modifying the value of the tag.  A good example is http://www.breezesys.com/Downloader.  Not all of them do though.  Often the only real way to ascertain whether a rotation has been lossless or lossy is to do a binary comparison in a hex editor if you know which sections to look at.
http://www.impulseadventure.com/photo/lossless-rotation-test.html

There is also the aspect of whether certain browsers and online image viewing applications acknowledge and use the Orientation tag value.  I can't find any recent tables that say which browsers will auto-rotate images based on the EXIF data, but I did find an article from back in 2012 where the writer did a lot of research.
http://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/
A lot has probably changed since then.

The moral of the story is that Windows will not show your images the way they were taken and intended to be viewed, and if you use the rotate option to "correct" this, it will screw up the image.  It is hard to know whether your image has been auto-rotated for viewing unless you open it in a few different applications.
0
xeniumAuthor Commented:
hi Bill, thanks a lot for the info, that's good to know. It certainly sounds like a minefield.

Do you think there is any reliable way to detect if a photo has been "mangled", and how, without actually opening it and looking at it? Apart from some kind of using image-recognition software. Anyway I can post this as a follow-up if there is any juice in it.

thanks again for your input.
0
xeniumAuthor Commented:
That article by Dave Perrett is good too thanks

If Google can’t handle images consistently across their own sites, on a browser that they built, what hope do the rest of us have?

hhahahaha
0
xeniumAuthor Commented:
No other solution offered.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.