Main Contents

determine shutter actuations for nikon d80 on linux

June 23, 2010

I have been shooting a Nikon D80 camera for the past couple of years. I wanted to know how many shutter actuations the camera had seen (essentially, how many pictures I had taken). This information is stored in the image’s EXIF data.

I’m running Fedora 12 on my laptop. In order to read the EXIF data, I installed the Image::ExifTool PERL module. You can do this by running the following command:

sudo yum install perl-Image-ExifTool

Once you have that installed, create a file called exif.pl with the following contents(this example almost copied verbatim from the Image::ExifTool documentation):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl
 
use strict;
use warnings;
use Image::ExifTool;
 
my %options;
 
my $file=$ARGV[0] or die("No file passed in");
 
 # Create a new Image::ExifTool object
my $exifTool = new Image::ExifTool;
 
$exifTool->Options(Unknown => 1);
my $info = $exifTool->ImageInfo($file);
my $group = '';
foreach my $tag ($exifTool->GetFoundTags('Group0')) 
{
    if ($group ne $exifTool->GetGroup($tag)) 
    {
        $group = $exifTool->GetGroup($tag);
        print "---- $group ----\n";
    }
 
    my $val = $info->{$tag};
    if (ref $val eq 'SCALAR') 
    {
        if ($$val =~ /^Binary data/) 
        {
            $val = "($$val)";
        } 
        else 
        {
            my $len = length($$val);
            $val = "(Binary data $len bytes)";
        }
    }
    printf("%-32s : %s\n", $exifTool->GetDescription($tag), $val);
}

Verify that the script has execute permissions:

chmod 755 exif.pl

Now, call the script by running the following command:

./exif.pl /path/to/a/jpeg/file.jpg

That will dump all of the EXIF data contained in the file. If you are only interested in the shutter count, pipe the results to grep:

./exif.pl /path/to/a/jpeg/file.jpg  | grep "Image Number"

In my case, this output:

Image Number                     : 10795

So I have taken about 11k pictures with my D80.

I know there are probably simpler ways of doing this either in GIMP, Photoshop, Lightroom, etc., but this is what works for me.

Filed under: Computers, Photography | Comments (0)

Leave a comment

Login