Debian Codegraph @

read_JPEG_metadata

raw
1 #!/usr/bin/perl -w
2 #
3 use strict;
4 use warnings;
5 use Image::MetaData::JPEG;
6
7 sub do_file {
8 my ($filename) = @_;
9 print '=' x 80 . "\nProcessing $filename ...\n";
10
11 # opening file and retrieving information
12 my $file = new Image::MetaData::JPEG($filename);
13 return print "Error: " . Image::MetaData::JPEG::Error() unless $file;
14
15 # get description
16 print $file->get_description(); # this shows all parsed JPEG records
17
18 # save file
19 # (my $basename = $filename) =~ s-^.*/([^/]+)$-$1-;
20 # $file->save("copy-$basename");
21 }
22
23 ### the main body starts here
24 if ($#ARGV < 0) { printf "Usage: $0 file [files]\n"; exit 2; }
25 while (my $filename = shift @ARGV) { do_file $filename ; }