Adding date to Photographs.

2010-04-07 2 min read Fedora Linux Photo

This is one of the common things that I want to do when I want to print the photos and its truely boring job to do given the fact that the Date Photo taken is already in the image taken by the Digital Photos. So finally I wrote a simple script to do this. Here it is for anyone who might be interested:

(Note you will need the program called anotate, written by me, posted earlier and exiftool)<pre style="padding-left: 30px;">

#!/usr/bin/perl <pre style="padding-left: 30px;">if ($#ARGV < 0 ) <pre style="padding-left: 30px;">{ <pre style="padding-left: 30px;">**    print "$#ARGV \n"; <pre style="padding-left: 30px;">    print "Usage $ARGV[0] filename/dir\n"; <pre style="padding-left: 30px;">    exit -1; <pre style="padding-left: 30px;">} <pre style="padding-left: 30px;">@files = `find "$ARGV[0]" -iname "jpg" -print`; <pre style="padding-left: 30px;">$count = 1; <pre style="padding-left: 30px;">foreach $file (@files) { <pre style="padding-left: 30px;">    if ($flag) { <pre style="padding-left: 30px;">        # system("annotate "$date" "$file" "$file""); <pre style="padding-left: 30px;">        # } <pre style="padding-left: 30px;">        # else { <pre style="padding-left: 30px;">        @details = `exiftool '$file'`; <pre style="padding-left: 30px;">        foreach $det (@details) { <pre style="padding-left: 30px;">            @words = split(/ : /, $det); <pre style="padding-left: 30px;">            $_ = $det ; <pre style="padding-left: 30px;">            chomp($words[1]); <pre style="padding-left: 30px;">            if (/Date\/Time Original/ ) { <pre style="padding-left: 30px;">                $date =$words[1] ; <pre style="padding-left: 30px;"> **** <pre style="padding-left: 30px;">            } <pre style="padding-left: 30px;">        } <pre style="padding-left: 30px;">    } <pre style="padding-left: 30px;">    system("annotate "$date" "$file" "$file""); <pre style="padding-left: 30px;">       ** <pre style="padding-left: 30px;">*    $count ++; <pre style="padding-left: 30px;">}** <pre style="padding-left: 30px;"> **** <p style="padding-left: 30px;">

comments powered by Disqus