File: read_JPEG_metadata

package info (click to toggle)
libimage-metadata-jpeg-perl 0.159-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,236 kB
  • sloc: perl: 3,676; makefile: 2
file content (25 lines) | stat: -rwxr-xr-x 708 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -w
#
use strict;
use warnings;
use Image::MetaData::JPEG;

sub do_file {
    my ($filename) = @_;
    print '=' x 80 . "\nProcessing $filename ...\n";

    # opening file and retrieving information
    my $file = new Image::MetaData::JPEG($filename);
    return print "Error: " . Image::MetaData::JPEG::Error() unless $file;
    
    # get description
    print $file->get_description(); # this shows all parsed JPEG records
    
    # save file
#    (my $basename = $filename) =~ s-^.*/([^/]+)$-$1-;
#    $file->save("copy-$basename");
}

### the main body starts here
if ($#ARGV < 0) { printf "Usage: $0 file [files]\n"; exit 2; }
while (my $filename = shift @ARGV) { do_file $filename ; }