EXIF Orientation Info

Paul Barrett

Well-known member
Messages
156
Solutions
1
Reaction score
14
Location
Hexham, UK
This request might be more appropriate on a Boxee Box forum but since Boxee has just been bought by Samsung the forums are in a bit of disarray at the moment.

Problem Statement:

When streaming photos stored on my NAS to my TV using teh Boxee Box some of them are oriented incorrectly. Randomly they are anything from 90 to 180 to 270 degrees out.

All of the photos in question are film that has been scanned either from negatives or print.

In windows explorer the images do not appear incorrect. (Well that's not entirely true - a few did but I rotated them in Windows Explorer and they now appear OK in Windows).

If I stream the same photos from a USB stick plugged into my router using DNLA they are fine.

So it seems that the Boxee Box is the only device that can't handle it. You might ask, 'Does it matter if the router is able to stream them?' And that would be true but for one thing - the Boxee has a rather nice way of auto panning and zooming duriing slideshows which my missus loves so I have to find a fix. There is no problem with any photo originated in digital.

The Boxee Box has a facility that allows you to rotate any image by stopping the slideshow, rotating the image and then continuing. Unfortunately it does not remember the setting so reverts to incorrect orientation when you next run the slideshow.

Possible Solution:

My theory is that since the scanned images do not have any orientation information the Boxee Box is becoming confused or is trying to be too clever.

So, after that long rambling explanation, my question is, is there an EXIF data attribute for orientation, what are its permitted values and how do I poke a value in there?
 
Paul Barrett wrote:

So, after that long rambling explanation, my question is, is there an EXIF data attribute for orientation, what are its permitted values and how do I poke a value in there?
http://www.exif.org/Exif2-2.PDF Orientation field, table 3 p 16. Values, p 18. Field name 'Orientation', tag ID 274 (112 Hex)

Exiftool has lots of options for managing EXIF data conveniently, for example:

exiftool -Orientation=1 -n -overwrite_original img.jpg

Unfortunately, Exiftool documentation page seems to be out of commission at present. This link has some examples, and this http://linux.die.net/man/1/exiftool (-n option) may help.

Several utilities, such as XnView will change orientation by re-writing the EXIF data.

HTH

--
Alan Robinson
 
Last edited:
my question is, is there an EXIF data attribute for orientation, what are its permitted values
Yes the TAG is Named: -Orientation -n
and how do I poke a value in there?
Examples:

exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Horizontal (normal)

1%20Horizontal%20%28normal%29.jpg


exiftool -orientation=2 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Mirror horizontal

2%20Mirror%20horizontal.jpg


exiftool -orientation=3 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Rotate 180

3%20Rotate%20180.jpg


exiftool -orientation=4 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Mirror vertical

4%20Mirror%20vertical.jpg


exiftool -orientation=5 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Mirror horizontal and rotate 270 CW

5%20Mirror%20horizontal%20and%20rotate%20270%20CW.jpg


exiftool -orientation=6 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Rotate 90 CW

6%20Rotate%2090%20CW.jpg


exiftool -orientation=7 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Mirror horizontal and rotate 90 CW

7%20Mirror%20horizontal%20and%20rotate%2090%20CW.jpg


exiftool -orientation=8 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg
= Rotate 270 CW

8%20Rotate%20270%20CW.jpg


Don't forget to use a Browser/Photo-Viewer there respect the Orientation TAG !



Regards: Carsten
 
Last edited:
(All) Orientation TAGs in one Photo:

Orientation%20TAGs.png




Regards: Carsten
 
Alan and Carsten

Thank you for your responses. I will experiment tomorrow. I have irfanview - I assume I can poke the values using that?
 
OK so it's been a while since I played with the command line but I am up for it. Just need some advice so I understand what is happening and with the documentation being inaccessible I need your help please guys.

exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

What's the bit in bold doing? Is that the path to the file to be processed? Are you assuming it's on the desktop?

If you could give me a bit of a breakdown of the command line and explain any assumptions I would be grateful. Digging that out of the (-k) "documentation" is no easy task! :)

e.g. do I need to spell out users/--/desktop in more detail?
 
Paul Barrett wrote:

OK so it's been a while since I played with the command line but I am up for it. Just need some advice so I understand what is happening and with the documentation being inaccessible I need your help please guys.

exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

What's the bit in bold doing? Is that the path to the file to be processed? Are you assuming it's on the desktop?

If you could give me a bit of a breakdown of the command line and explain any assumptions I would be grateful. Digging that out of the (-k) "documentation" is no easy task! :)

e.g. do I need to spell out users/--/desktop in more detail?
If you have a Win OS, save yourself the command-line grief, and get ExifTool GUI 5.15:

http://u88.n24.queensu.ca/exiftool/...0.0.html?PHPSESSID=1mq93d1kdv3ddbh5eaoal4dp87

Even though the developer (Bogdan) appears to have stopped supporting the application, it is a mature application that should have no problems with any future releases of ExifTool.

Exiftool GUI is a non-installing, portable (can be run out of any logical-drive) item. "ExifTool.exe" (renamed to that, with the "switch" removed from the file-name) can be placed in the very same folder, or (alternatively) placed in the "C:\Windows" folder itself. Ditto for the other two EXE's that unzip along with ExifTool GUI (which are associated with specific JPG image actions, and are not essential).

Phil Harvey's ExifTool site appears to be down at the moment - but it's easy to find (Google "exiftool"). You will need to download and unzip the latest (or any old version, I suppose) of ExifTool for use in conjuction with ExifTool GUI.

Here are instructions for changing meta-data tag values (from Phil Harvey's ExifTool instructions):

.

-TAG[+-]=[VALUE]

Write a new value for the specified tag (ie. -comment=wow), or delete the tag if no VALUE is given (ie. -comment=). += and -= are used to add or remove existing entries from a list, or to shift date/time values (see Image::ExifTool::Shift.pl for details). += may also be used to increment numerical values, and -= may be used to conditionally delete or replace a tag (see WRITING EXAMPLES for examples).

TAG may contain a leading family 0 or 1 group name separated by a colon. If no group name is specified, the tag is created in the preferred group, and updated in any other location where a same-named tag already exists. The preferred group is the first group in the following list where TAG is valid: 1) EXIF, 2) IPTC, 3) XMP.

The special All tag may be used in this syntax only if a VALUE is NOT given. This causes all meta information to be deleted (or all information in a group if -GROUP:All= is used). Note that not all groups are deletable, and that the JPEG APP14 "Adobe" group is not removed by default with -All= because it may affect the appearance of the image. Use the -listd option for a complete list of deletable groups. Also, within an image some groups may be contained within others, and these groups are removed if the containing group is deleted:

JPEG Image:
- Deleting EXIF or IFD0 also deletes ExifIFD, GlobParamIFD,
GPS, IFD1, InteropIFD, MakerNotes, PrintIM and SubIFD.
- Deleting ExifIFD also deletes InteropIFD and MakerNotes.
- Deleting Photoshop also deletes IPTC.

TIFF Image:
- Deleting EXIF only removes ExifIFD which also deletes
InteropIFD and MakerNotes.

Note: MakerNotes tags may be edited, but not created or deleted individually. This avoids many potential problems including the inevitable compatibility problems with OEM software which may be very inflexible about the information it expects to find in the maker notes.

Special feature: Integer values may be specified in hexadecimal with a leading 0x, and simple rational values may be specified as fractions.

.

ExiTool GUI has a sub-interface for entering ExifTool commands directly (called "ExifTool Direct" - see button in lower-center area). Find and use that to change meta-data tag values.

In the IFD0 section of the Exif meta-data, you will find a tag named, "orientation". It will have a value of either "Horizontal (normal)", or "Rotate 270 CW".

The bad news is that chaging that tag value does not (necessarily) solve your problems. It appears to depend upon the particular applciation that inspects the image-file meta-data, and ...

... there clearly is (at least one) other portion(s) of image-file meta-data that (also) affect the orientation that (at least some) applications will display images at. Try changing the state of that tag that is visible in ExifTool GUI, and (maybe) it will work for you.

Have frustrated myself before with this. Something else (that ExifTool GUI doesn't reveal) also exists.

DM ... :P
 
Last edited:
Man, this is not easy.

I can't download the GUI (Error 403). I assume this is because one has to be registered on the site. Have tried to register but no authentication eMail has been received (have checked SPAM folder on mail server)
 
Paul Barrett wrote:

Man, this is not easy.

I can't download the GUI (Error 403). I assume this is because one has to be registered on the site. Have tried to register but no authentication eMail has been received (have checked SPAM folder on mail server).
Aha. I should have thought of that. Bogdan uses Phil Harvey's ExifTool site server (which is presently down). No biggie. PM me an email address, and we can work that situation out for you.
 
Last edited:
Detail Man wrote:
Paul Barrett wrote:

Man, this is not easy.

I can't download the GUI (Error 403). I assume this is because one has to be registered on the site. Have tried to register but no authentication eMail has been received (have checked SPAM folder on mail server).
Aha. I should have thought of that. Bogdan uses Phil Harvey's ExifTool site server (which is presently down). No biggie. PM me an email address, and we can work that situation out for you.
Done! :)
 
Paul Barrett wrote:

OK so it's been a while since I played with the command line but I am up for it. Just need some advice so I understand what is happening and with the documentation being inaccessible I need your help please guys.

exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

What's the bit in bold doing? Is that the path to the file to be processed? Are you assuming it's on the desktop?

If you could give me a bit of a breakdown of the command line and explain any assumptions I would be grateful. Digging that out of the (-k) "documentation" is no easy task! :)

e.g. do I need to spell out users/--/desktop in more detail?
-n tells exiftool to use numeric values for the EXIF data (1 in this case). Without the '-n', exiftool assumes '1' is an abbreviation for '180 degree rotation'. With '-n', it sets the default orientation (no rotation).

I believe the '\ Tag/' is to process a directory named 'Orientation Tag', and prevent Perl command line processing treating the name as two separate arguments. I don't have exiftool installed under Windows, but that should be the effect under Linux.

If you supply one or more filename arguments, exiftool will modify the orientation field, and save the original file as 'filename.jpg_original'. Add the -overwrite_original flag to avoid generating multiple copies once you are happy it is working properly (or just delete the *_original files when you are done).

Cheers,

--
Alan Robinson
 
Last edited:
exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

What's the bit in bold doing? Is that the path to the file to be processed?

Are you assuming it's on the desktop?
Yes, the Photo is in a Folder named "Orientation Tag" on the Desktop.
The "\ " stands for the Space-Key " ".

exiftool -orientation=6 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

exiftool is the Program.
-orientation is the EXIF-TAG.
=6 stands for Rotate 90 CW.
-n is needed for the Orientation-Numbers (Easy): -orientation=6.
/Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg is the complete File-Path for the Photo.
If you could give me a bit of a breakdown of the command line and explain any assumptions I would be grateful. Digging that out of the (-k) "documentation" is no easy task! :)

e.g. do I need to spell out users/--/desktop in more detail?
Normally i drag and drop the Photo(s) in the Command-Window to add the complete File-Path.
For a Example:

I write in the Command-Window/Line: exiftool -orientation=6 -n
With a Space " " at the End.

OrientationTag1.png


Now i drag and drop the Photo(s) in the Command-Window.

OrientationTag2.png


Now it looks like this in the Command-Window/Line:
exiftool -orientation=6 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

OrientationTag3.png


Now push the Enter/Return-Key in the Command-Window/Line to process...

OrientationTag4.png


...and the Photo is updated with the new Orientation TAG.
Hope that Helps a bit.



Regards: Carsten
 
Last edited:
Detail Man wrote:
Paul Barrett wrote:

OK so it's been a while since I played with the command line but I am up for it. Just need some advice so I understand what is happening and with the documentation being inaccessible I need your help please guys.

exiftool -orientation=1 -n /Users/--/Desktop/Orientation\ Tag/_DSF5042k.jpg

What's the bit in bold doing? Is that the path to the file to be processed? Are you assuming it's on the desktop?

If you could give me a bit of a breakdown of the command line and explain any assumptions I would be grateful. Digging that out of the (-k) "documentation" is no easy task! :)

e.g. do I need to spell out users/--/desktop in more detail?
If you have a Win OS, save yourself the command-line grief, and get ExifTool GUI 5.15:

http://u88.n24.queensu.ca/exiftool/...0.0.html?PHPSESSID=1mq93d1kdv3ddbh5eaoal4dp87

Even though the developer (Bogdan) appears to have stopped supporting the application, it is a mature application that should have no problems with any future releases of ExifTool.

Exiftool GUI is a non-installing, portable (can be run out of any logical-drive) item. "ExifTool.exe" (renamed to that, with the "switch" removed from the file-name) can be placed in the very same folder, or (alternatively) placed in the "C:\Windows" folder itself. Ditto for the other two EXE's that unzip along with ExifTool GUI (which are associated with specific JPG image actions, and are not essential).

Phil Harvey's ExifTool site appears to be down at the moment - but it's easy to find (Google "exiftool"). You will need to download and unzip the latest (or any old version, I suppose) of ExifTool for use in conjuction with ExifTool GUI.

Here are instructions for changing meta-data tag values (from Phil Harvey's ExifTool instructions):

.

-TAG[+-]=[VALUE]

Write a new value for the specified tag (ie. -comment=wow), or delete the tag if no VALUE is given (ie. -comment=). += and -= are used to add or remove existing entries from a list, or to shift date/time values (see Image::ExifTool::Shift.pl for details). += may also be used to increment numerical values, and -= may be used to conditionally delete or replace a tag (see WRITING EXAMPLES for examples).

TAG may contain a leading family 0 or 1 group name separated by a colon. If no group name is specified, the tag is created in the preferred group, and updated in any other location where a same-named tag already exists. The preferred group is the first group in the following list where TAG is valid: 1) EXIF, 2) IPTC, 3) XMP.

The special All tag may be used in this syntax only if a VALUE is NOT given. This causes all meta information to be deleted (or all information in a group if -GROUP:All= is used). Note that not all groups are deletable, and that the JPEG APP14 "Adobe" group is not removed by default with -All= because it may affect the appearance of the image. Use the -listd option for a complete list of deletable groups. Also, within an image some groups may be contained within others, and these groups are removed if the containing group is deleted:

JPEG Image:
- Deleting EXIF or IFD0 also deletes ExifIFD, GlobParamIFD,
GPS, IFD1, InteropIFD, MakerNotes, PrintIM and SubIFD.
- Deleting ExifIFD also deletes InteropIFD and MakerNotes.
- Deleting Photoshop also deletes IPTC.

TIFF Image:
- Deleting EXIF only removes ExifIFD which also deletes
InteropIFD and MakerNotes.

Note: MakerNotes tags may be edited, but not created or deleted individually. This avoids many potential problems including the inevitable compatibility problems with OEM software which may be very inflexible about the information it expects to find in the maker notes.

Special feature: Integer values may be specified in hexadecimal with a leading 0x, and simple rational values may be specified as fractions.

.

ExiTool GUI has a sub-interface for entering ExifTool commands directly (called "ExifTool Direct" - see button in lower-center area). Find and use that to change meta-data tag values.

In the IFD0 section of the Exif meta-data, you will find a tag named, "orientation". It will have a value of either "Horizontal (normal)", or "Rotate 270 CW".

The bad news is that chaging that tag value does not (necessarily) solve your problems. It appears to depend upon the particular applciation that inspects the image-file meta-data, and ...

... there clearly is (at least one) other portion(s) of image-file meta-data that (also) affect the orientation that (at least some) applications will display images at. Try changing the state of that tag that is visible in ExifTool GUI, and (maybe) it will work for you.

Have frustrated myself before with this. Something else (that ExifTool GUI doesn't reveal) also exists.
Here are some more notes archived from Phil's ExifTool help docs (regarding tags, and tag values):

.

Currently, ExifTool can write most of the EXIF tags that anyone could reasonably want to change (but some tags are protected because they describe physical characteristics of the image that you can not change with ExifTool, ie. Compression). Also, all of the GPS, IPTC and XMP information and most of the MakerNotes information can be edited. This gives you great power, but with great power, comes great responsibility...

It is possible for you to write nonsense into a file, which could cause other image readers to throw up their hands in despair and refuse to read the image. For this reason, it is best to always preserve the original copy of your image file. The "exiftool" script does this for you automatically by renaming the original file and always working on a copy.

The writing logic for ExifTool is the reverse of the reading logic. You provide human-readable values and ExifTool will perform the conversions for you. For instance, you can set "WhiteBalance" to "Daylight" and ExifTool will change the value of WhiteBalance in the image wherever the tag is found provided that "Daylight" is a valid value for that location. ExifTool will even do some simple matching so that you could even just set it to "day", and ExifTool will search through the valid values and will choose the one that contains the string "day". If the value is ambiguous, the tag will not be set. If no tags can be set with the specified value, ExifTool returns an error message.

The tag values can also be specified at a numerical level by disabling the print conversions that are normally applied. This can be done on a tag-by-tag basis or on a global basis through either the application or the API.

As well as changing tag values wherever they are found in the image, exiftool will also create the tag in the preferred group if it didn't exist there before. By default, the preferred group is the first of the following where the tag is found: 1) EXIF, 2) IPTC, 3) XMP. Alternatively, the desired group (in family 0 or 1) can be specified so ExifTool only writes the tag to a single location. For example, with the command line interface, this is done using an argument like "-EXIF:WhiteBalance=Manual".

If a tag is added to a group that doesn't exist, the new group is created in the file, and required mandatory tags may be created. Conversely, if the last non-mandatory tag is deleted from a group, the group is removed from the file.

.

DM ... :P
 
Last edited:
If You want to use Exiftool on a Windows System,
You must first Rename the Exiftool Program from exiftool(-k).exe to: exiftool.exe.

Then move the Renamed Exiftool Program to the C:/Windows Folder...

Exiftool%20DateiPfad%20Windows.png


...now You can use Exiftool from the Command-Line.
(Enter cmd in the search Window and push the Return-Key).

Regards: Carsten
 
Last edited:

Keyboard shortcuts

Back
Top