Rotation questions

Started by spruce18b, November 14, 2011, 04:32:48 PM

Previous topic - Next topic

spruce18b

The documentation in exiftool_pod.pdf and in https://exiftool.org/TagNames/index.html does not describe the -Orientation tag and its options. Could you please tell me where to look for information? If I rotate an image will the orientation by 90 degrees will the orientation tag also change and will the vertical and horizontal values be switched? Thanks

Phil Harvey

Quote from: spruce18b on November 14, 2011, 04:32:48 PM
If I rotate an image will the orientation by 90 degrees will the orientation tag also change and will the vertical and horizontal values be switched? Thanks

Yes and no.  It depends on the software.

Most image editing software will rotate the JPEG image and set the Orientation to Horizontal.  But it is also possible to leave the JPEG image alone and change only the Orientation tag. See the EXIF specification for details.

- 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 ($).

spruce18b

I clicked on EXIF specification (DC-008-2010_E.pdf) and searched for "-orientation" and found only one mention on p. 181 of DC-008-2010_E.pdf with no details of the options for the -orientation  tag.

Phil Harvey

The Orientation tag is described on pages 30-35 of this document (in rather excruciating detail).

- 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 ($).

spruce18b

Thanks for your quick response. Excruciating, yes. All I am looking for is a summary of the main -orientation options like

> exiftool -Orientation -S a.jpg

as shown on p. 10 of exiftool_pod.pdf.

For example, if CW stands for clockwise, is there counterclockwise? What does -S mean for -orientation? Please tell me where to find a list of all the options for -orientation. Thanks.

Phil Harvey

OK, then I am confused because you started this thread by referring to the tag name documentation.  This table of valid string values for the Orientation tag is given in the EXIF section of this documentation:

    1 = Horizontal (normal)
    2 = Mirror horizontal
    3 = Rotate 180
    4 = Mirror vertical
    5 = Mirror horizontal and rotate 270 CW
    6 = Rotate 90 CW
    7 = Mirror horizontal and rotate 90 CW
    8 = Rotate 270 CW


It sounds like this is what you are asking for.

The -S option in the command you mentioned just prints the tag name instead of the description and avoids extra spaces in the output (as described at the bottom of page 11 in the application PDF documentation).  It applies to all tags when extracting information.  In the case of the Orientation tag, the description and the tag name are identical so the -S only removes extra spaces before the colon.

- 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 ($).

spruce18b

C:\DATA\Pictures\SAmerica2011\Reduced>c:\batch\exif\rotate01.bat

C:\DATA\Pictures\SAmerica2011\Reduced>c:\apps\exiftool\exiftool.exe  -orientatio
n=8 TempRotateDSC03313.JPG
    1 image files updated

I rotated the attached image with the code shown above but it did not appear rotated as expected. The original is unrotated when viewed as a thumbnail and with the HTML code shown below, but it is rotated when I view it with Irfan.

Thanks

   <tr><td>
<a href="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=-0.900043056,-89.61081806 &aq=&ie=UTF8&t=f&z=16&vpsrc=0&ecpose=-0.900043056,-89.61081806 ,1025.22,0,0,0"> <img src=DSC03313.JPG  width="600 " height="337.5 "></a></td></tr><tr>
<td width="600 " style="color:blue">Caption:DSC03313.JPG <br/><br/></td><td width="600 "allign="right"> 17 <br/><br/></td></tr>

Phil Harvey

To change the orientation of the thumbnail, write IFD1:Orientation.  Writing Orientation without specifying a location will set the orientation of the main image only.

Whether or not this EXIF Orientation information is honoured depends on the software, as you have discovered.  If you want something that works will all software you need to actually rotate the image data and set Orientation to Horizontal, but you can't do this with ExifTool because it can't be used to modify the image data.

- 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 ($).

spruce18b

Hi Phile, Please tell me how to change the command below with the IFD1:Orientation option:

c:\apps\exiftool\exiftool.exe  -orientation=8 TempRotateDSC03313.JPG

Thanks

spruce18b

Hi Phil, Sorry about misspelling your name.

BogdanH

Hi,

I think Phil ment something like:
c:\apps\exiftool\exiftool.exe  -IFD1:Orientation#=8 TempRotateDSC03313.JPG

Bogdan

Phil Harvey

Quote from: BogdanH on November 17, 2011, 04:34:13 PM
I think Phil ment something like:
c:\apps\exiftool\exiftool.exe  -IFD1:Orientation#=8 TempRotateDSC03313.JPG

Exactly.  You can set both this and the normal (IFD0) Orientation tag with the same command.  The "#" that Bogdan has used on the tag name is explained in FAQ number 6.

- 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 ($).

spruce18b

Hi BogdanH and Phil, Thank you for staying with me on this.

I rotated an image with the following command:

C:\DATA\Pictures\SAmerica2011\Reduced\temp>c:\apps\exiftool\exiftool.exe  -IFD1:Orientation#=8 DSC03479.JPG
    1 image files updated

The photograph (attached) of marine tortoise sand tracks appears in portrait orientation when viewed in Irfan but it is in landscape orientation when viewed with the HTML attached document both before and after rotation with the above command. The picture should be in portrait orientation when viewed with the HTML document.

Could you please tell me what I am doing wrong?

Thanks

Thanks.

BogdanH

I didn't pay attention that you mentioned showing correct oriented image in html...
First, your attached original jpg has correct Orientation tag value, so there's no need to change anything in this regard.

I'm using quite old Firefox browser, but as far I know (I'm not expert on this), there's no browser which would automatically rotate image according to Exif:Orientation value. If you see somewhere that images are automatically rotated, then (I believe) that's achieved by using some script code on server -that is: image is rotated (according to Orientation value) before it is sent to your browser.
So, I suggest you simply phisically rotate images which you wish to show in your html pages.

Bogdan

spruce18b

Hi Bogdan, Thanks for the response. If I understand your answer correctly, you are saying that I cannot expect a browser to respect rotation settings created from EXIF commands. If that is the case, then in what situations will EXIF rotation commands such as,

c:\apps\exiftool\exiftool.exe  -IFD1:Orientation#=8 DSC03479.JPG

be useful?