Author Topic: How to set the EXIF orientation flag  (Read 8707 times)

Arni

  • Jr. Member
  • **
  • Posts: 14
How to set the EXIF orientation flag
« on: February 23, 2014, 09:40:02 AM »
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)
Code: [Select]
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
Code: [Select]
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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17004
    • ExifTool Home Page
Re: How to set the EXIF orientation flag
« Reply #1 on: February 23, 2014, 10:11:25 AM »
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

  • Jr. Member
  • **
  • Posts: 14
Re: How to set the EXIF orientation flag
« Reply #2 on: February 23, 2014, 11:22:54 AM »
Thank you very much, Phil.

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

Arni

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17004
    • ExifTool Home Page
Re: How to set the EXIF orientation flag
« Reply #3 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

  • Jr. Member
  • **
  • Posts: 14
Re: How to set the EXIF orientation flag
« Reply #4 on: February 23, 2014, 02:49:56 PM »
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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
exiftool -all= -trailer:all= image.jpg


Arni

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17004
    • ExifTool Home Page
Re: How to set the EXIF orientation flag
« Reply #5 on: February 23, 2014, 05:28:00 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.

Quote
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

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

Quote
Furthermore, 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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

  • Jr. Member
  • **
  • Posts: 14
Re: How to set the EXIF orientation flag
« Reply #6 on: February 24, 2014, 02:36:10 PM »
Hi Phil,

Odd that you found it in the man page, because you should have found it in FAQ 6.
Sure, I did. :P

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?

Code: [Select]
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

-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

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 17004
    • ExifTool Home Page
Re: How to set the EXIF orientation flag
« Reply #7 on: February 24, 2014, 07:48:00 PM »
Hi Arni,

Is there any difference in execution for the following 4 commands?

Code: [Select]
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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Arni

  • Jr. Member
  • **
  • Posts: 14
Re: How to set the EXIF orientation flag
« Reply #8 on: February 25, 2014, 06:02:30 AM »
Thank you very much for the explanation, Phil.

Have a very nice day, my friend. :)

Arni