Adding dates to your photos.
#!/usr/bin/perl
if ($#ARGV < 0 )
{
print ”$#ARGV \n”;
print ”Usage $ARGV[0] filename/dir\n”;
exit -1;
}
@files = `find ”$ARGV[0]” -iname ”*jpg” -print`;
if ($#ARGV > 3 ) { $cmd = 1;}
$count = 1;
foreach $file (@files) {
chomp ($file);
@details = `exif1 ’$file’`;
$flag = 1;
$flag2 = 0;
$flag_w = 0;
$date = ””;
foreach $det (@details) {
@words = split(/–>/, $det);
$_ = $det ;
chomp($words[1]);
if (/Date/ ) {
$date =$words[1] ;
$flag = 0;
}
}
if ($flag) {
@details = `exiftool ’$file’`;
foreach $det (@details) {
@words = split(/ : /, $det);
$_ = $det ;
chomp($words[1]);
if (/Date\/Time Original/ ) {
$date =$words[1] ;
}
}
}
system(”annotate ”$date” ”$file” ”$file””);
$count ++;
} <a name="more">
Related Articles:
- 2008/11/20 Add border to images from command line using montage.
- 2009/10/08 root shell auditing and syslog entry for all commands of shell
- 2009/10/01 Boot Linux Over HTTP With boot.kernel.org (BKO)
- 2009/09/26 7-deadly-linux-commands
- 2009/09/26 Configure sendmail for SMTP relay with your ISP
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.