Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Rotate photos using exiftool and AppleScript Apps
I often have to rotate my photos to the proper orientation, because my camera doesn't have position sensor. I'd like to do this operation without loss of quality, so I discovered exiftool, which simply rewrites some exif tags. The exiftool itself is a command line application, so I've created a simple GUI in AppleScript. The script is follows: Save the script as an application and simply drag the image (it should also work for multiple images) on the app. You will be asked which side to rotate. It may happen that you will have to adjust to values in the script (8 and 6); these values work with my camera. I personally use the app as an external editor for iPhoto.
    •    
  • Currently 2.18 / 5
  You rated: 2 / 5 (11 votes cast)
 
[11,850 views]  

Rotate photos using exiftool and AppleScript | 8 comments | Create New Account
Click here to return to the 'Rotate photos using exiftool and AppleScript' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Rotate photos using exiftool and AppleScript
Authored by: mesa on Oct 26, '09 08:59:06AM

You can also use jpegtran from the independent jpeg group (ijg.org). It can rotate the jpeg data without re-encoding it.



[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: Dr. T on Oct 26, '09 10:53:34AM

Don't most modern graphics, photo editing, and image cataloging applications know how to rotate a JPEG image in 90 degree increments without altering the underlying JPEG data? Do we really need special scripts or applications to do this?



[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: robogobo on Oct 26, '09 01:43:47PM

You would think so, but for example if you rotate an image in Preview and then upload it to a website, the rotation doesn't take (and it recompresses). Not sure how it's working, but I used to have to use an exif utility when rotating. Lately I've gone back to using photoshop, which also does recompress.



[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: Doc Drang on Oct 26, '09 09:56:18AM

I had sort of the opposite problem; photos taken looking down on a subject often had their EXIF rotation tag set incorrectly because of how I was holding the camera just before turning it to look down. I wrote a shell script called "derotate" that used exiftool to fix the tag:

http://www.leancrew.com/all-this/2009/04/derotating-jpegs-with-exiftool/

My worry about rotating JPEGs in a graphics program is that the image will degrade because the JPEG compression is reapplied to the rotated image. The nice thing about exiftool is that you can look through the Perl code and see that it's affecting only the EXIF tags, not the image itself.

---
Doc Drang
http://www.leancrew.com/all-this


[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: Old Toad on Oct 26, '09 11:02:48AM
Try the donationware image editor, Xee, which losslessly rotates image files.

[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: nperry on Oct 26, '09 12:11:48PM

If you are using iPhoto the suggested jpegtran is better than exiftool.

At least with iPhoto'08 if the orientation flag is set on an image then iPhoto will generate an internal "edited" version with the image rotated, rather than simply display the original image rotated on-the-fly. While the original image is kept the internal one is also, doubling your disk usage.

Using jpegtran losslessly rotates the image data and iPhoto does not generate its internal "edited" version.

You can use jpegtran to rotate images whose orientation flags are correct (i.e. if the orientation flag indicates image is rotated the data can be rotated and the orientation flag set to indicate no rotation). This has the dual benefit of saving disk space in iPhoto and supporting those programs which don't understand the orientation flag.



[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: mox51 on Dec 16, '09 02:57:30AM

nperry wrote
If you are using iPhoto the suggested jpegtran is better than exiftool.

I searched for jpegtran for Mac OS X and could not find it ; could you give me a link ?

Thanks in advance



[ Reply to This | # ]
Rotate photos using exiftool and AppleScript
Authored by: tedw on Dec 16, '09 11:55:30AM
just for information's sake, you can rotate images from applescript using os X's built-in Image Events app:
set theFile to choose file
tell application "Image Events"
	set thisImage to open theFile
	rotate thisImage to angle 90
	save thisImage
end tell
I don't know this is lossless for a fact, but it uses Apple's Core Image routines which are supposedly pixel-by-pixel transformations, so it should be.

[ Reply to This | # ]