Adding date to Photographs.

2010-04-07 247 words 2 mins read

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;">


author

Authored By Amit Agarwal

Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it