Photo Tools

Perl scripts for digital photography

Jon Allen

Organising your photos

Most cameras will give each photo a unique filename

Unfortunately, these are not very memorable:

DCIM/
  100CANON/
    DSCF12345.JPG
    DSCF12346.JPG
    DSCF12347.JPG

and so on...

Renaming by hand

Renaming files by hand doesn't work either...

photos/
  cats/
    colin.jpg
    colin_2.jpg
    colin_3.jpg

What can we do automatically?

The basics of organisation are:

  • What is it a picture of?
  • When did we take it?
  • Is it any good?

"What" requires a GPS, "Is it any good" is purely subjective, but the computer can tell us "When" an image was taken.

copyphotos.pl

$ copyphotos.pl <source> <destination>

Renames files based on timestamp, and creates year/month/date directory structure:

2005/
  10/
    25/
      20051025191633.JPG
      20051025204201.JPG
    28/
      20051028091547.JPG

copyphotos.pl

http://perl.jonallen.info/projects/phototools

  • Uses EXIF data (via Image::ExifTool)
  • Fallback to file timestamp
  • Handles burst mode

    20051125200143.JPG
    20051125200143_1.JPG
    20051125200143_2.JPG
    

Camera aspect ratios

Camera formats have two main aspect ratios:

  • 3/2 (1.5)

    Most DSLRs (Canon, Nikon, Pentax, Konika Minolta, etc), 35mm film

  • 4/3 (1.33)

    Most digital compact cameras, Olympus DSLRs, 645 medium-format film

Paper aspect ratios

Standard paper formats have many different aspect ratios:

  • 6x4 (1.5)
  • 7x5 (1.4)
  • 10x8 (1.25)
  • A4 (1.41)

Crop or Fit?

Most high-street printers will automatically crop images to fit the paper size

This may not always be what you want...

photofit.pl

$ photofit.pl --paper-size <papersize>
  <infile> <outfile>

Adds white borders to infile so that it matches the aspect ratio of papersize

New image is saved as outfile

photofit.pl

http://perl.jonallen.info/projects/phototools

  • Uses Paper::Specs to get page ratios
  • Requires Image::Magick and Image::Size

Have fun!

S5 Presents

  • Create your own presentations for free at S5 Presents.