ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Arni on February 23, 2014, 09:40:02 AM

Title: How to set the EXIF orientation flag
Post by: Arni on February 23, 2014, 09:40:02 AM
Hi Phil,

As I was reading from >here< (http://www.impulseadventure.com/photo/exif-orientation.html) 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
Title: Re: How to set the EXIF orientation flag
Post by: Phil Harvey on February 23, 2014, 10:11:25 AM
I think that reading FAQ number 6 (https://exiftool.org/faq.html#Q6) may help you to understand what is happening here.

- Phil
Title: Re: How to set the EXIF orientation flag
Post by: Arni on February 23, 2014, 11:22:54 AM
Thank you very much, Phil.

I think I found the right Print Conversion Lookup Table here (https://exiftool.org/TagNames/EXIF.html).
I will try soon.

Arni
Title: Re: How to set the EXIF orientation flag
Post by: 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.

- Phil
Title: Re: How to set the EXIF orientation flag
Post by: Arni on February 23, 2014, 02:49:56 PM
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
Title: Re: How to set the EXIF orientation flag
Post by: Phil Harvey on February 23, 2014, 05:28:00 PM
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
Title: Re: How to set the EXIF orientation flag
Post by: Arni on February 24, 2014, 02:36:10 PM
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
Title: Re: How to set the EXIF orientation flag
Post by: Phil Harvey on February 24, 2014, 07:48:00 PM
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
Title: Re: How to set the EXIF orientation flag
Post by: Arni on February 25, 2014, 06:02:30 AM
Thank you very much for the explanation, Phil.

Have a very nice day, my friend. :)

Arni