ExifTool Forum

ExifTool => The Image::ExifTool API => Topic started by: Theone3000 on June 14, 2019, 07:40:13 PM

Title: Date taken created perl windows
Post by: Theone3000 on June 14, 2019, 07:40:13 PM
Hi All,
I built a perl program to check for duplicate images, I have perl installed on Windows 10 computer. I can print of about 40 hashes and keys, but I cannot find the created or taken date!?.
Is it possible using perl exiftool?.
And it seems some of the exif data is nested hashes/arrays! (which i can read)

thanks
Andrew
Title: Re: Date taken created perl windows
Post by: Phil Harvey on June 14, 2019, 08:57:21 PM
Hi Andrew,

What hashes and keys are you talking about?  Are you using the Image::ExifTool API (https://exiftool.org/ExifTool.html)?

Of course you can do this with ExifTool, as long as the metadata exists in the file.

- Phil
Title: Re: Date taken created perl windows
Post by: StarGeek on June 14, 2019, 11:27:46 PM
Also, there is no such thing as a date taken tag.  It's a Windows property that can be filled from several different tags.  See the Windows metadata (https://exiftool.org/forum/index.php/topic,6591.msg32875.html#msg32875) thread.

Title: Re: Date taken created perl windows
Post by: Theone3000 on June 18, 2019, 06:09:01 AM
I am using the Image::ExifTool API, but, when I print the keys, followed by what should be in it {a hash} sometimes I get a second or third level of hash result, and an array!.
I am on a windows 10 system, programing through windows, and I have scoured the internet, and cannot find any simple explanatory code to read a jpeg meta data file. There seems to be two primary ways, but neither give the results required!.
Title: Re: Date taken created perl windows
Post by: Phil Harvey on June 18, 2019, 07:21:11 AM
If you are using the Struct option then there may be many levels of hashes/arrays returned.

- Phil
Title: Re: Date taken created perl windows
Post by: Theone3000 on June 19, 2019, 09:30:38 AM
so here is the code I am attempting to use:-
use strict;
use warnings;
use Image::ExifTool;
my $exifTool = new Image::ExifTool;
my $sourceImageFileName = "E:/ANSWR/NSWRailLines/DSC42335.JPEG";
$exifTool->ExtractInfo($sourceImageFileName);
my $info = $exifTool;

my $model = $exifTool->GetValue("Model");
print "model is ".$model."\n";
if($$info{'EXIF:DateTimeOriginal'}){ print "there is original time stamp ".$$info{'EXIF:DateTimeOriginal'}."\n"; }
else{ print "there is no original time stamp\n"; }

if($$info{'EXIF:DateTime'}){ print "there is time stamp ".$$info{'EXIF:DateTime'}."\n"; }
else{ print "there is no date time stamp\n"; }

if($$info{'EXIF:CreateDate'}){ print "there is create date stamp ".$$info{'EXIF:CreateDate'}."\n"; }
else{ print "there is no create date stamp\n"; }

if($$info{"ExtendedXMP"}) { print "Extended XMP stamp exists\n"; }
else{ print "there is no Extended XMP stamp\n"; }

And none of it works, it all draws a blank!, and why the double dollar symbol "$$"?, is that not a pid thing?
Title: Re: Date taken created perl windows
Post by: Phil Harvey on June 19, 2019, 09:35:08 AM
Hi Andrew,

Change these lines:

Code: [Select]
$exifTool->ExtractInfo($sourceImageFileName);
my $info = $exifTool;

To this:

Code: [Select]
my $info = $exifTool->ImageInfo($sourceImageFileName);
And remove the "EXIF:" from your tag keys when accessing the values in the $info hash.

The double "$$" is necessary because $info is a hash reference, not a hash.  You need an extra "$" to dereference it to access the hash values.  You could either do it this way, or derefernence like this: $info->{DateTimeOriginal}

- Phil