Is there a way to detect the orientation of a photo? Recent cameras seem to be able to flag the orientation of a photo even though it is always recorded in landscape. In other words the image file is 1600x1200 but when you open it in preview it will auto rotate to 1200x1600. However when I import images into AE they alway come in at 1600x1200 and don't auto rotate, is there a way to detect the orientation? Even if it is through the command line?
Thanks
Detecting Photo Image Orientation
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
If the Orientation info is tagged in the photo file, you can retrieve its value using XMP metadata.
example of orientation tag value
1:normal
6:rotate(90)
-> see the javascript tools guide for more info on xmpscript
-> http://www.exif.org/Exif2-2.PDF - page 18
Code: Select all
. import AdobeXMPScript lib
. new XMPFile()
. getXMP()
. closeFile(0)
. xmpObj.iterator()
. while (next = it.next())
. orientation test
. retrieve tag value
1:normal
6:rotate(90)
-> see the javascript tools guide for more info on xmpscript
-> http://www.exif.org/Exif2-2.PDF - page 18
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
awesome, thanks nab.
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
Hey Nab,
I am successfully reading and updating the orientation but I am not able to change the image width and height tags so that the image's orientation is changed by swapping height and width. Is it just not possible to do that through XMP?
-Lloyd
I am successfully reading and updating the orientation but I am not able to change the image width and height tags so that the image's orientation is changed by swapping height and width. Is it just not possible to do that through XMP?
-Lloyd
I would say it's not possible but I'm no xmp expert at all.
You could apply the rotation in AE, or use command line tool to rotate the image (e.g. 'convert -rotate' from ImageMagick, look at the doc here)
You could apply the rotation in AE, or use command line tool to rotate the image (e.g. 'convert -rotate' from ImageMagick, look at the doc here)
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
Yes, I am coming to the same conclusion. I can't use image magick since the install is so geeky I can't expect users to want to do it so I might just do the rotation in AE or Bridge.
Thanks
Thanks
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
This script will fix the orientation: http://aescripts.com/photoorientationfixer/