Author Topic: Date taken created perl windows  (Read 533 times)

Theone3000

  • Newbie
  • *
  • Posts: 3
Date taken created perl windows
« 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

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Date taken created perl windows
« Reply #1 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?

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, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

  • Global Moderator
  • ExifTool Freak
  • *****
  • Posts: 2838
Re: Date taken created perl windows
« Reply #2 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 thread.

Troubleshooting hints:
* When posting, include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).
* Double all percent signs (%) in a Windows batch file.
* If your GPS coords are negative, make sure and set the GpsLatitudeRef and GpsLongitudeRef tags correctly.

Theone3000

  • Newbie
  • *
  • Posts: 3
Re: Date taken created perl windows
« Reply #3 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!.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Date taken created perl windows
« Reply #4 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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Theone3000

  • Newbie
  • *
  • Posts: 3
Re: Date taken created perl windows
« Reply #5 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?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Date taken created perl windows
« Reply #6 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
« Last Edit: June 19, 2019, 09:57:36 AM by Phil Harvey »
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).