#!/usr/bin/perl use Image::ExifTool; use strict; # I know there is an easier, prettier way to do this, but # this works for me and I wrote it quickly, so... my @skip = qw(BlueBalance CreateDate DateTimeOriginal FileName FileSize FocalLength35efl ModifyDate RedBalance ShutterCount SubSecTime SubSecTimeDigitized SubSecTimeOriginal ThumbnailImage ThumbnailLength ThumbnailOffset FNumber MaxApertureValue ExposureTime ImageSize NEFCurve1 NEFCurve2 StripByteCounts StripOffsets ImageHeight ImageWidth FocalLengthIn35mmFormat PreviewImage PreviewImageLength); my %files = (); my %exif = (); foreach my $file (@ARGV) { $files{$file} = undef unless -s $file; my $info = Image::ExifTool->new->ImageInfo($file); foreach my $key (sort keys %$info) { (my $value = $info->{$key}) =~ s/\s+/ /g; push @{$exif{$key}}, $value; } $files{$file} = $info; } my %differences; my %attributes; foreach my $file (sort keys %files) { my $info = $files{$file}; foreach my $attribute (sort keys %{$info}) { push @{$attributes{$attribute}}, $info->{$attribute}; } } foreach my $attribute (sort keys %attributes) { next if grep { $attribute =~ m/$_/ } @skip; my @differences = (); my $found; foreach my $att (@{$attributes{$attribute}}) { push @differences, $att; foreach my $try (@{$attributes{$attribute}}) { $found++ unless $try eq $att; } } @differences = () unless $found; $differences{$attribute} = \@differences; } my $header = "tag "; foreach my $file (sort keys %files) { $header .= sprintf("%-28s ", $file); } print "$header\n"; print '-' x length $header, "\n"; foreach my $diff (sort keys %differences) { next unless @{$differences{$diff}}; printf("%-23s ", $diff); foreach my $value (@{$differences{$diff}}) { printf("%-28s ", $value); } print "\n"; }