How to set the EXIF orientation flag

Started by Arni, February 23, 2014, 09:40:02 AM

Previous topic - Next topic

Arni

Hi Phil,

As I was reading from >here< there are 8 possible values for an
EXIF orientation flag (values "1" to "8").

I tried to set the orientation flag by the following 8 commands:
(using quotation marks around the value doesn't make any difference)

exiftool -orientation=1 dir
exiftool -orientation=2 dir
exiftool -orientation=3 dir
exiftool -orientation=4 dir
exiftool -orientation=5 dir
exiftool -orientation=6 dir
exiftool -orientation=7 dir
exiftool -orientation=8 dir

Only the first and last command (for values "1" and "8") being executed.
Both rotate the images 180 degrees. Followed by the command

exiftool '-filename<%f [${orientation}].%e' dir

it appends [Rotate 180] to their filenames, seperated by a space.
Actually, I wanted to append the number of the orientation (values "1"..."8")
to their filenames, but that's a minor matter.


For orientation flag values "2" and "7" I got the following error message:

Warning: Can't convert IFD0:Orientation (matches more than one PrintConv)
Nothing to do.



For all other values ("3", "4", "5", "6") I got the following error message:

Warning: Can't convert IFD0:Orientation (not in PrintConv)
Nothing to do.



I don't know what the error messages does mean.
Please tell me what to do to set the orientation flag the right way.


Arni

Phil Harvey

I think that reading FAQ number 6 may help you to understand what is happening here.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

Thank you very much, Phil.

I think I found the right Print Conversion Lookup Table here.
I will try soon.

Arni

Phil Harvey

But it sounded to me as if you wanted to use the numerical values.  So you don't need to concern yourself with the lookup table.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

Quote from: Phil Harvey on February 23, 2014, 11:50:05 AM
But it sounded to me as if you wanted to use the numerical values.  So you don't need to concern yourself with the lookup table.

Yes Phil, you are right.

I found the -n option in the ExifTool (man) page that does exactly what I want.

For example:

exiftool -n -orientation=3 /Users/Arni/Desktop/Test -r
exiftool -n '-filename<%f [OF-${orientation}].%e' /Users/Arni/Desktop/Test -r


should be identically to:

exiftool -orientation="Rotate 180" /Users/Arni/Desktop/Test -r
exiftool '-filename<%f [OF-3].%e' /Users/Arni/Desktop/Test -r



In the first example, I tried to put both commands in one command. But (for me) that was not possible.

In the second example does not work the second command. I don't know why. It causes an error like:

Warning: No writable tags set from /Users/Arni/Desktop/Test/Picture_5.jpg


Furthermore, I have one more question. Does the command exiftool -all= image.jpg include
the command exiftool -trailer:all= image.jpg or is it nessesary to write the following command:

exiftool -all= -trailer:all= image.jpg



Arni

Phil Harvey

Quote from: Arni on February 23, 2014, 02:49:56 PM
I found the -n option in the ExifTool (man) page that does exactly what I want.

Odd that you found it in the man page, because you should have found it in FAQ 6.

QuoteIn the first example, I tried to put both commands in one command. But (for me) that was not possible.

In the second example does not work the second command. I don't know why. It causes an error like:

Warning: No writable tags set from /Users/Arni/Desktop/Test/Picture_5.jpg

If you are not copying the values of tags from a file, you should be assigning the value with "=" instead of "<":

exiftool -n -orientation=3 '-filename=%f [OF-3].%e' /Users/Arni/Desktop/Test -r

QuoteFurthermore, I have one more question. Does the command exiftool -all= image.jpg include
the command exiftool -trailer:all= image.jpg

-all= deletes all metadata from a JPEG, with one exception:  The Adobe APP14 group is not deleted because it contains color transformation information that is vital for image display.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

Hi Phil,

Quote from: Phil Harvey on February 23, 2014, 05:28:00 PM
Odd that you found it in the man page, because you should have found it in FAQ 6.
Sure, I did. :P

Quote from: Phil Harvey on February 23, 2014, 05:28:00 PM
If you are not copying the values of tags from a file, you should be assigning the value with "=" instead of "<":
Thank you very much for the info about assignments for tags. That was the reason for causing an error.
Is there any difference in execution for the following 4 commands?


exiftool "-filename=%f [OF-3].%e" file
exiftool -filename="%f [OF-3].%e" file
exiftool '-filename=%f [OF-3].%e' file
exiftool -filename='%f [OF-3].%e' file


Quote from: Phil Harvey on February 23, 2014, 05:28:00 PM
-all= deletes all metadata from a JPEG, with one exception:  The Adobe APP14 group is not deleted because it contains color transformation information that is vital for image display.
I think that means YES, the option -all= does include the option -trailer:all=


Arni

Phil Harvey

Hi Arni,

Quote from: Arni on February 24, 2014, 02:36:10 PM
Is there any difference in execution for the following 4 commands?


exiftool "-filename=%f [OF-3].%e" file
exiftool -filename="%f [OF-3].%e" file
exiftool '-filename=%f [OF-3].%e' file
exiftool -filename='%f [OF-3].%e' file

On Mac/Linux, these are all equivalent.  On Windows, only the ones with double quotes will work.

On Mac/Linux, special characters may also be escaped with a backslash instead of quoting:

exiftool -filename=%f\ \[OF-3\].%e file

My favourite is this:

exiftool -filename="%f [OF-3].%e" file

Because it works on all systems and syntactically makes the most sense to me.  (Since the operation is effectively assigning a string value to FileName.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

Thank you very much for the explanation, Phil.

Have a very nice day, my friend. :)

Arni