Date taken created perl windows

Started by Theone3000, June 14, 2019, 07:40:13 PM

Previous topic - Next topic

Theone3000

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

Phil Harvey

Hi Andrew,

What hashes and keys are you talking about?  Are you using the Image::ExifTool API?

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

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

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 thread.

* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Theone3000

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!.

Phil Harvey

If you are using the Struct option then there may be many levels of hashes/arrays returned.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Theone3000

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?

Phil Harvey

#6
Hi Andrew,

Change these lines:

$exifTool->ExtractInfo($sourceImageFileName);
my $info = $exifTool;


To this:

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).