I use imagemagick to create index images to my photo albums to get a quick overview without looking through all the pictures.
This is how I create a simple photo collage using imagemagicks montage command
montage -label '%t\n%wx%h' -resize 150x150 '*.JPG' -geometry +3+3 -tile 3x -frame 5 _Index.JPG
Tags: imagemagick, montage
Posted by Hans-Henry Jakobsen
I’ve always wanted to use Adobe Photoshop Lightroom to store the central library database on a network drive and be able to access it from different computers. This has not been possible because Lightroom is not a multiuser enabled software, and if you try to use a network drive you get the following error message “Lightroom cannot use the Database location you have chosen because it is located on a network volume.”
One solution to this problem is to use the good old MS-DOS subst command to map the network share. This should be done from at command prompt (cmd.exe)
subst X: \\server\sharename
Another method is to subst an already exising network drive
subst X: P:
Where P: is your network drive and X: is the new substituded drive letter.
There are however some things that have to be considered before using this solution
Posted by Hans-Henry Jakobsen
This rename trick can be run in Windows, Linux and even Mac since the commandline program I’m going to use, exiv2, is available in all three platforms. Rename all image files in current folder to the format YYYYMMDDHHMM_Filename.EXT
This has been tested on my Nikon D80 JPEG and NEF image files.
Linux
exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls)
Windows (from the command prompt)
exiv2.exe -r %Y%m%d-%H%M_:basename: rename d*
Windows (in a MS-DOS batch file)
exiv2.exe -r %%Y%%m%%d-%%H%%M_:basename: rename d*
You have to add an extra % if you are going to use exiv2 in a Windows batch file, because % in batch files is treated as a variable and not as a switch to exiv2.
These examples require that you have access to the exiv2 program from the current folder.
Result
Now my image files have names like
20071022-1202_DSC_9727.JPG 20071022-1202_DSC_9727.NEF
Change in workflow
Since I rename all my files in the format YYYYMMDD-HHMM_Filename I’ve included it in my image “workflow” (a simple MS-DOS batch file) I wrote about in Rotate images depending on the EXIF orientation post.
This has been tested successfully on the Windows exiv2 version 0.16
The new batch file can be downloaded here.
Tags: D80, EXIF, exiv2, jhead, jpeg, ms-dos, NEF, Nikon, script
Posted by Hans-Henry Jakobsen
This is a modified version of my Resize of images in a folder with imagemagick post back in February. Only difference this time is that i strips out EXIF tags and the script has been cleaned up a bit. Click on the image to see the result in full size.
#!/bin/bash
# Description:
# Script to resize JPG images to desired width defined in IMAGESIZE variable.
# EXIF tags is also removed from the result images.
# Software needed:
# jhead - http://www.sentex.net/~mwandel/jhead/
# imagemagick - http://www.imagemagick.org
IMAGESIZE="320 480"
for IMAGEFILE in $(ls|grep JPG)
do
for I in $IMAGESIZE
do
# create directories if needed
if [ ! -d $I ]
then
mkdir $I
fi
# Strip EXIF tag information from source file
jhead -purejpg $IMAGEFILE
# Resize file
base=`basename $IMAGEFILE .JPG`_Resized_$I.JPG
convert $IMAGEFILE -resize $I $base
# Watermark the file
width=`identify -format %w $base`
convert -background '#0008' -fill white -gravity center -size ${width}x15 \
-font Verdana -pointsize 10 \
caption:"Copyright © 2007 Pario.no" \
+size $base +swap -gravity south -composite $I/$base;
# delete resized file
rm $base
done
# Delete source file (DO NOT USE YOUR ORIGINAL FILE!)
rm $IMAGEFILE
done
You can download my resize, watermark bash script here.
Tags: bash, convert, imagemagick, jhead
Posted by Hans-Henry Jakobsen
Sometimes a image files creation date is wrong and have to be corrected. This is a script I use to set a files creation date to the photos date retrieved from EXIF tags. The exiftool program should be available to run this script.
#!/usr/bin/env perl
use strict;
$|++;
use Image::ExifTool qw(ImageInfo);
use Time::Local;
for my $file (@ARGV) {
my $ii = ImageInfo($file, qw(DateTimeOriginal DateTime))
or warn("Skipping $file\n"), next;
my ($created) =
grep /\S/, @$ii{qw(DateTimeOriginal DateTime)};
next unless $created;
warn "using $created for $file\n";
if ($created =~ s/([-+ ])(\d\d):(\d\d)$//) {
my ($sign, $hour, $minute) = ($1, $2, $3);
# warn "ignoring offset of $sign $hour:$minute\n";
}
my @digits = $created =~ /(\d+)/g or next;
if ($digits[0] < 1900) {
warn "bad year $digits[0] for $file";
next;
}
$digits[0] -= 1900;
$digits[1] -= 1;
my $gmtime = timegm(reverse @digits);
if ($gmtime > time or $gmtime < time - 86400*90) {
warn "preposterous gmtime for $file: ", scalar gmtime $gmtime;
# next;
}
utime($gmtime, $gmtime, $file) or warn "Cannot utime on $file: $!";
}
Save it as datebyexif.pl
Usage:
./datebyexif.pl *.JPG
Download the datebyexif.pl script
Source: http://www.macosxhints.com/comment.php?mode=view&cid=83366
Posted by Hans-Henry Jakobsen