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

Preserve photo timestamp when exporting from iPhoto UNIX
When photos are exported from iPhoto using the Export function, all the photos will get the current date/time stamp. But if you use any of these photos in an app that organizes them by date/time, then the organization will be lost. For example, I export a set of images from iPhoto to view in my Wii's photo tool, but those images are organized by date.

To fix this problem, I took advantage of the EXIF data in the JPEG images from my digital camera. To batch change a large set of images, I use the open source command-line tool jhead, which is available as a pre-compiled Intel binary (source code is also available from the website, or via Fink).

I copied the jhead binary into an Applications folder in my home directory, and made it executable with the following command:
chmod 750 jhead
Then I wrote a simple shell script to batch update the images:
#!/bin/bash

for i in *.JPG; do base=`basename "$i" .JPG`; mv "$i" "$base".jpg;done
find . -type f -name "*.jpg" -exec ~/Applications/jhead -ft {} \;
Don't forget to make the shell script executable as well.To run the script, just change into the directory with all images and run the shell script.

[robg adds: This worked for me, though the script does more than just change the date -- it also changes the extension from .JPG to .jpg. In my case, my exports already had a lower-case name, and I didn't want the filename changed, so I simplified the script by just using the second (find . -type...) line.

Once I had it down to one line, I realized a script wasn't necessary. Instead, I created a new alias in my .profile file:
alias fixdate="find . -type f -name \"*.jpg\" -exec ~/bin/jhead -ft {} \;"
Now after an export, I just cd to the directory and type fixdate to correct the date on the exported images.]
    •    
  • Currently 2.27 / 5
  You rated: 3 / 5 (11 votes cast)
 
[9,900 views]  

Preserve photo timestamp when exporting from iPhoto | 7 comments | Create New Account
Click here to return to the 'Preserve photo timestamp when exporting from iPhoto' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
jhead -ft
Authored by: SeanAhern on Jul 30, '09 09:30:05AM
The biggest part of this hint is the functionality of "jhead -ft". Per the documentation (http://www.sentex.net/~mwandel/jhead/usage.html), the -ft option "Sets the file's system time stamp to what is stored in the Exif header." Very nice!

[ Reply to This | # ]
Optimization of find
Authored by: SeanAhern on Jul 30, '09 09:36:16AM
Rather than executing jhead for every image, why not leverage xargs and make the whole thing even faster:

find . -type f -name \*.jpg -print0 | xargs -0 jhead -ft

Or, if your JPGs are all in one flat directory, a single command will do the trick as well:

jhead -ft *.jpg

[ Reply to This | # ]
Preserve photo timestamp when exporting from iPhoto
Authored by: Dr. T on Jul 30, '09 10:12:47AM

For those who prefer graphical user interfaces, there are free utilities that can fix photo dates in batch mode (and do other tasks, too). I use PhotoInfo 2.0.1. It is available from VersionTracker and MacUpdate.



[ Reply to This | # ]
Preserve photo timestamp when exporting from iPhoto
Authored by: TvE on Jul 30, '09 11:55:17AM
As opposed to chmod 750 jhead (that only makes it executable for the owner!) you can save a little typing by using chmod +x jhead and also make it executable for everybody ;-)

[ Reply to This | # ]
Preserve photo timestamp when exporting from iPhoto
Authored by: c8h10n4o2 on Jul 30, '09 12:15:26PM

I consider this personal preference. Since the app is saved in an Applications folder in my home directory, I prefer to err on the side of more secure and only make it executable by the owner.



[ Reply to This | # ]
An aside question
Authored by: jimhoyt on Jul 30, '09 01:57:00PM

Is there a way to search photo EXIF DateTimeOrigiinal or DateTimeDigitized via Spotlight? I haven't found one and it seems an obvious oversight.

Thanks.



[ Reply to This | # ]
execute jhead?
Authored by: ascanio on Jul 30, '09 11:47:53PM

When I try to execute jhead in Terminal I get the following:

????^G^C^B^K?^E?: Command not found.
^KPAA@?6l^Y^A:^V^P?^X^A6^EP^A^P^_@: Command not found.

jhead downloaded from sentex.net as MacOS X executable (dragging the link on the download window), setting as executable with chmod a+x , put in /bin.

Any help/suggestion?



[ Reply to This | # ]