From the Canyon Edge -- :-Dustin

Friday, July 2, 2010

Keeping Pictures from Multiple Cameras in Temporal Order


I use as many as 4 different cameras, each serving a slightly different purpose.

In order decreasing order of portability, and increasing order of photo quality:
  1. Pocket -- a low-quality, but always present camera phone (either my Palm Pre or my G1)
  2. Small -- Canon Powershot SD1000
  3. Medium -- Kodak z812 IS
  4. Large -- Canon EOS Digital Rebel XTi
When I'm traveling, I might take 2 or more of these cameras, and shoot pictures all day long on different cameras. Sometimes, I'm shooting with one camera, and Kim is shooting with the other. At the end of the day, I want to merge all of these pictures, and look at them in order.

To keep this straight, I take great care to ensure that the embedded clocks in all of these cameras are perfectly in sync.

And when I'm processing my pictures, I often use gthumb to rename my pictures, embedding the timestamp in the name.


Other times, I'll write a small script to do this for me.

Earlier today, as I was stitching my pictures together from 3 different cameras, I realized that one of the clocks was off by about a day. I used this little script to fix the timestamps:

#!/usr/bin/php
<?php
$dh = opendir(".");
while (($file = readdir($dh)) !== false) {
if (preg_match("/^IMG_/", $file)) {
$s = stat($file);
touch($file, $s[9] - 86400);
}
}
?>
After I did that, I also needed to update the EXIF data embedded in the JPG too. To do that, I used jhead.

jhead -dsft IMG_*

Of course, running jhead on these files modified them yet again, so the file's timestamps are screwed up again. Let's cover our tracks.



#!/usr/bin/php
<?php
$dh = opendir(".");
while (($file = readdir($dh)) !== false) {
if (preg_match("/^IMG_/", $file)) {
$exif_data = exif_read_data($file);
touch($file, strtotime($exif_data['DateTime']));
}
}
?>


Enjoy!

:-Dustin

5 comments:

  1. It's funny how different photographers describe their kit. My 'large' camera is my Nikon F5! It's a monster of a camera, but amazing!

    ReplyDelete
  2. I'd recommend using Phatch for this kind of stuff. No need for scriptfoo and it's much more flexible than gThumb in terms of what you can do with the Exif tags (I like to create folders based on year, then month taken, for example)

    The main phatch website is http://photobatch.stani.be/ and it's in the repos.

    Also, I wrote a short Exif article ages ago which talks about tagging your photos jBrout :
    http://www.scaine.net/site/2010/01/jbrout/

    jBrout is pretty awesome at manipulating the Exif in your photos, adding categories/tags or even comments which will then be searchable by tools like Picasa.

    ReplyDelete
  3. For a moment I got excited and I thought you'd show us how to ntpdate your cameras!

    ReplyDelete
  4. Why not use Rapid Photo Downloader - it's a awesome easy-to-use tool that can download all of your images to where exactly YOU want it, as well as renaming your images.

    Want it in a [Year] \ [Month] folder structure and all images renamed to [date] at [hhmmss]-[subsecond].[ext]?

    Can do that.

    Want to do it with multiple memory cards? Yup can do that too.

    It can even import videos too and put it into different folder for you too should you wish. Cover a lot of what you're looking for here but without scripting and so on. I've been using it, hence why I think it's great so give it a try, the homepage for it is here - http://www.damonlynch.net/rapid/ and there's a PPA for it - ppa:dlynch3/ppa

    ReplyDelete
  5. I just put out a new version of Rapid Photo Downloader. You can now preview files before downloading them, and some other cool things too.

    ReplyDelete

Please do not use blog comments for support requests! Blog comments do not scale well to this effect.

Instead, please use Launchpad for Bugs and StackExchange for Questions.
* bugs.launchpad.net
* stackexchange.com

Thanks,
:-Dustin

Printfriendly