The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Image::Nikon::Index - Perl package for indexing Nikon camera image files


  use Image::Nikon::Index;
  use Getopt::Long;
  my %opts;
  GetOptions ( \%opts, 'folder=s', 'prefix=s', 'suffix=s', 'transform' );
  my %args;
  chdir $opts{'folder'} if defined $opts{'folder'};
  $args{'prefix'} = $opts{'prefix'} if defined $opts{'prefix'};
  $args{'suffix'} = $opts{'suffix'} if defined $opts{'suffix'};
  my $nikon = Image::Nikon::Index->new ( %args );
  $nikon->transform if defined $opts{'transform'};


Image::Nikon::Index is a simple package to restructure Nikon format camera generated image files, which takes up a naming format easy for indexing and archiving. The package changes default file names into a format containing date in compact form and indexed in order of when the photos have been taken.

For a photo taken on 2015 Jun 12 at 8:35:20, which may have been subsequently modified at a later date or time, the name update is as below:

  original name: DSC_2019.NEF
  date and time: 2015 Jun 12 at 8:35:20
  subtime  mexp: 30
  updated  time: 2015 Jun 12 at 18:20:10
  image newname: E612_SERIAL.NEF

Now, that SERIAL is generated by sorting based on date and time for which the key is 2015061208352020150612182010, consisting of original date, time, updated date, time. For frequent use without checking what is being changed and how, the following could be handy:

  use Image::Nikon::Index;
  chdir $ARGV[0] if defined $ARGV[0];
  my $nikon = Image::Nikon::Index->new (prefix=>'DSC', suffix=>'NEF');
  exit (0);




Snehasis Sinha, <>


Copyright (C) 2015 by Snehasis Sinha

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.