#!/usr/bin/perl # Scan images in a list or gqview collection and prepare them for gal-gen # (c) 2004--2007 Martin Mares use Image::EXIF; use Data::Dumper; use strict; use warnings; my @pics = (); if (@ARGV) { @pics = @ARGV; } else { while () { chomp; /^#/ && next; /^$/ && next; if (/^"(.*)"$/) { push @pics, $1; } else { die "Parse error: $_"; } } } foreach my $f (@pics) { my $e = new Image::EXIF($f); my $i = $e->get_all_info(); if ($e->error) { print STDERR "EXIF error on $f: ", $e->error, "\n"; } else { #print STDERR Dumper($i), "\n"; my $o = $i->{'image'}->{'Image Orientation'} || "Top, Left-Hand"; if ($o eq "Top, Left-Hand") { $o = "."; } elsif ($o eq "Right-Hand, Top") { $o = "r"; } elsif ($o eq "Left-Hand, Bottom") { $o = "l"; } elsif ($o eq "Bottom, Right-Hand") { $o = "d"; } else { print STDERR "Unrecognized orientation: $o\n"; $o = "."; } my $d = $i->{'image'}->{'Image Created'} || "?"; if ($d ne "?") { $d =~ s/^(\d{4}):(\d{2}):(\d{2}) (\d{2}:\d{2}:\d{2})/$1-$2-$3 $4/ or die "Date parse error: $d"; } print "$f\t$d\t$o\tn\n"; } }