Re: Getting capture date of a photo
Re: Getting capture date of a photo
- Subject: Re: Getting capture date of a photo
- From: Shane Stanley <email@hidden>
- Date: Tue, 20 Mar 2018 09:11:35 +1100
TOn 20 Mar 2018, at 8:22 am, Jan Erik Moström <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>
<www.macosxautomation.com/applescript/apps/>, <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