Photo Resizing

for i in *
do
mogrify $i -resize 640×480 i
done

Adding dates to your photos.

Add date in the photograph with a perl script.

#!/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 ++;
}

Add border to images from command line using montage.

Adding a border to the images from command line is quite simple. But if you have couple of images in a directory that you want to add border to then it may become quite painful 🙂

So what is the solution. You can simply use a one liner to do the job for you.

for i in *.jpg; do montage -geometry 720×576 -background black -quality 100 $i conv-$i; done