• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Getting capture date of a photo
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting capture date of a photo
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: Getting capture date of a photo
  • Next by Date: Re: Getting capture date of a photo
  • Previous by thread: Re: Getting capture date of a photo
  • Next by thread: Re: Getting capture date of a photo
  • Index(es):
    • Date
    • Thread