We've expanded our news coverage and improved our search! Visit news.oreilly.com for the latest or search for all things across O'Reilly!
advertisement

Article:
  Automatically Import Images into iPhoto
Subject:   Correct image timestamp for Nokia phones
Date:   2004-11-28 02:01:40
From:   Michael_Steil
Bluetooth file transfer does not transfer the timestamp of a file - but Nokia phones (like my 7650) include the timestamp in the JPEG comment field. I use the following script to extract this information, rename the files according to the timestamp in the comment field and set the file timestamp accordingly. Then I import the files into iPhoto.


#!/bin/bash
# renamenokia.sh
# extract date&time from jpegs and rename them
for i in *.jpg; do date=`strings "$i" |grep "^..\...\.200.$"`; time=`strings "$i" | grep "..:..:.."`; echo $date $time; mv "$i" "$date $time.jpg"; done


# change the date of the jpegs to the one specified in their names
for i in *.jpg; do touch -t `echo "$i" | perl -pi -e 's/(..)(\.)(..)(\.)(....)( )(..)(:)(..)(:)(..).jpg/$5$3$1$7$9.$11/g'` "$i"; done


Your phone might store the timestamp in a different format (e.g. localized), so make backups of the files before, and if the script does not work, use the "strings" command to see what the format is like.


This way, all my photos always have the correct time information - and not the information about when it has been transferred to the computer.


It would be nice if someone could
* make the script more generic (possible use a better method to extract the date)
* include this script into the AppleScript in the article.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Correct image timestamp for Nokia phones
    2005-02-17 06:33:50  Harald_Hoyer [Reply | View]

    Perl script to extract Date and Time from Nokia Images:
    http://harryh.homelinux.org/index.php?p=40