Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

printing metadata Tag using ExifTool

by g_speran (Beadle)
on Apr 13, 2021 at 19:24 UTC ( #11131216=perlquestion: print w/replies, xml ) Need Help??

g_speran has asked for the wisdom of the Perl Monks concerning the following question:

Hello Perl Monks

I am trying to use ExifTool to extract some Metadata TAGS. I've searched for a specific use case but was unsuccessful. Ive constructed some simple code to accomplish what I am trying to do, but I am looking for verification that I am doing it correctly to extract the necessary variables or is there a simpler way.

use Image::ExifTool qw(:Public); use Data::Dumper; $file='d:/60486581538__715F9238-09E5-4806-8146-0626DAFB0E36.JPG'; $ExifTool = new Image::ExifTool; #$ExifTool->Options(DateFormat => '%Y-%m-%d'); $info = $ExifTool->ImageInfo($file,'SubSecCreateDate','LensModel'); #$info = $ExifTool->ImageInfo($file); print "INFO: $info\n"; $createdate=$$info{'SubSecCreateDate'}; $lens=$$info{'LensModel'}; print "\nCreate Date: $createdate\n"; print "Lens Model: $lens\n\n"; print Dumper($info); exit; D:\>metadata.pl INFO: HASH(0x2b9f148) Create Date: 2020:03:02 13:16:55.336-05:00 Lens Model: iPhone 7 back camera 3.99mm f/1.8 $VAR1 = { 'LensModel' => 'iPhone 7 back camera 3.99mm f/1.8', 'SubSecCreateDate' => '2020:03:02 13:16:55.336-05:00' }; D:\>

Replies are listed 'Best First'.
Re: printing metadata Tag using ExifTool
by g_speran (Beadle) on Apr 13, 2021 at 19:39 UTC

    I think I my have answered my own question

    use Image::ExifTool qw(:Public); use Data::Dumper; $file='d:/60486581538__715F9238-09E5-4806-8146-0626DAFB0E36.JPG'; $ExifTool = new Image::ExifTool; #$ExifTool->Options(DateFormat => '%Y-%m-%d'); $info = $ExifTool->ImageInfo($file,'SubSecCreateDate','LensModel'); #$info = $ExifTool->ImageInfo($file); print "INFO: $info\n"; # Setting Variable Reading Hash Method $createdate=$$info{'SubSecCreateDate'}; $lens=$$info{'LensModel'}; print "\nHASH Method\n"; print "\tCreate Date: $createdate\n"; print "\tLens Model: $lens\n\n"; # Setting Variable using ExifTool GetValue Method $createdate2=$ExifTool->GetValue('SubSecCreateDate'); $lens2=$ExifTool->GetValue('LensModel'); print "ExifTool GetValue Method\n"; print "\tCreate Date2: $createdate2\n"; print "\tLens Model2: $lens2\n\n"; print "Dumping Variable\n\t"; print Dumper($info); exit; D:\>metadata.pl INFO: HASH(0x2b91f48) HASH Method Create Date: 2020:03:02 13:16:55.336-05:00 Lens Model: iPhone 7 back camera 3.99mm f/1.8 ExifTool GetValue Method Create Date2: 2020:03:02 13:16:55.336-05:00 Lens Model2: iPhone 7 back camera 3.99mm f/1.8 Dumping Variable $VAR1 = { 'SubSecCreateDate' => '2020:03:02 13:16:55.336-05:00', 'LensModel' => 'iPhone 7 back camera 3.99mm f/1.8' }; D:\>

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11131216]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2021-05-14 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (150 votes). Check out past polls.

    Notices?