Re: Getting capture date of a photo
Re: Getting capture date of a photo
- Subject: Re: Getting capture date of a photo
- From: Luc Naets <email@hidden>
- Date: Tue, 20 Mar 2018 07:49:29 +0000
- Thread-topic: Getting capture date of a photo
dear scripters,
Is it also possible to read the xmp from an image if it exists?
There’s probably a lot more info in the xmp available, like a original filename
or documentID…
any idea Shane?
thnx!
On 20 Mar 2018, at 05:21,
email@hidden<mailto:email@hidden>
wrote:
Date: Tue, 20 Mar 2018 09:11:35 +1100
From: Shane Stanley
<email@hidden<mailto:email@hidden>>
To: AS users
<email@hidden<mailto:email@hidden>>
Subject: Re: Getting capture date of a photo
Message-ID:
<email@hidden<email@hidden">mailto:email@hidden>>
Content-Type: text/plain; charset="utf-8"
TOn 20 Mar 2018, at 8:22 am, Jan Erik Moström
<email@hidden<mailto:email@hidden>> wrote:
I'm trying to get the capture date of a photo
You can get it from the Spotlight metadata using my Metadata Lib
<https://www.macosxautomation.com/applescript/apps/Script_Libs.html<https://www.macosxautomation.com/applescript/apps/Script_Libs.html>>
like this:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use script "Metadata Lib" version "2.0.0"
set POSIXPath to POSIX path of (choose file)
set theMetadata to fetch metadata for item POSIXPath
return kMDItemContentCreationDate of theMetadata
Or you can read it from EXIF data, assuming it still has the EXIF data,
directly like this:
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit" -- for image stuff
set POSIXPath to POSIX path of (choose file)
set theImageRep to current application's NSBitmapImageRep's
imageRepWithContentsOfFile:POSIXPath
set theEXIFData to theImageRep's valueForProperty:(current application's
NSImageEXIFData)
if theEXIFData is missing value then error "No EXIF data found"
return theEXIFData's objectForKey:("DateTimeOriginal" as text)
--
Shane Stanley <email@hidden<mailto:email@hidden>>
<www.macosxautomation.com/applescript/apps/<http://www.macosxautomation.com/applescript/apps/>>,
<latenightsw.com<http://latenightsw.com/>>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden