The pertinent code + output:
#!/usr/bin/env perl use strict; use warnings; use feature 'say'; use Data::Printer; use Image::ExifTool qw(:Public); my $image = $ARGV[0]; my $exif = ImageInfo( $image, 'XResolution', 'YResolution' ); p $exif; my $xrez = $$exif{'XResolution'}; my $yrez = $$exif{'YResolution'}; say "Resolution is $xrez x $yrez."; __END__ \ { XResolution 180, YResolution 180 } Resolution is 180 x 180.
The full script:
#!/usr/bin/env perl # exif_extractor.pl use strict; use warnings; use Data::Printer; use Image::ExifTool qw(:Public); use Getopt::Long; my ( $image, $all, $help ); my $options = GetOptions( "image=s" => \$image, "all" => \$all, "help" => \$help, ); my $usage = <<USAGE_END; USAGE: $0 --image Image name --all Extract all Metadata by default, extracts: * CreateDate * Directory * FileName * FileNumber * MeasuredEV * OwnerName --help USAGE_END die "**NO IMAGE SPECIFIED**\n" . $usage unless $image; die $usage if $help; if ($all) { p ImageInfo($image); } else { p ImageInfo( $image, 'CreateDate', 'Directory', 'FileName', 'FileNumber', 'MeasuredEV', 'OwnerName' ); } exit;
In reply to Re: How to read Image Resolution on Mac OS X
by frozenwithjoy
in thread How to read Image Resolution on Mac OS X
by Jouve
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |