Page 1 of 1

date and time of image files

Posted: Thu Feb 09, 2017 12:10 pm
by carambola
Hi all,
how can I gathers date and time metadata from the image files?
I need to retrieve the date a photo was created before importing it.
Any idea?
Thanks.

Re: date and time of image files

Posted: Fri Feb 10, 2017 3:36 am
by PBH
Sorry I don't have time to explain more right now, but checkout the function for 'detailed files' or 'long files' in the dictionary.

It will give you all the data you need. :)

Link: https://livecode.com/resources/api/#liv ... ript/files

Paul

Re: date and time of image files

Posted: Mon Feb 20, 2017 1:40 pm
by MaxV
EXIF library is here for you: https://github.com/angerangel/livecodeExif

Re: date and time of image files

Posted: Mon Feb 20, 2017 1:50 pm
by jmburnod
Hi Max,
I use "detailed files" with a simple lineoffset (to get the target line) to do that.
from dictionary about "detailed files"
to obtain a date, time, name, ID, or list of files or folders with the greatest amount of available detail.
Here is a Richard's script
http://forums.livecode.com/viewtopic.ph ... 23#p151263
Best regards
Jean-Marc

Re: date and time of image files

Posted: Thu Feb 23, 2017 6:41 pm
by MaxV
Please note that images may have an internal data structure called EXIF. The EXIF tags have a lot of informations, like creation date.
The operating systems has information about files, but only regarding the operation system itself; creation date is external to file, and is about the filesystem hierarchy.
So a copied file can have a newer creation date, because is new; on the contrary the EXIF datas remain unchanged even copied, because their are internal data of the image.

Re: date and time of image files

Posted: Thu Feb 23, 2017 7:36 pm
by jmburnod
Hi Max,
Thanks for share.
the EXIF datas remain unchanged even copied
Very interesting and it seems simple to use.
I'm impatient to use it for one script that check if an image exist in a folder (same data with different filename)
Best regards
Jean-Marc

Re: date and time of image files

Posted: Fri Feb 24, 2017 3:04 pm
by MaxV

Re: date and time of image files

Posted: Sun Dec 15, 2019 5:35 pm
by Simon Knight
Bump!

I stumbled across this thread and thought I would add the following system call that works on MacOS:

Code: Select all

put shell("mdls -raw -name kMDItemContentCreationDate '" &  tImageFileSpec & "'" ) into tMyVar 
Terminal describes the syntax:
usage: mdls [-name attr][-sdb] [-raw [-nullMarker markerString]] [-plist file] path
list the values of one or all the attributes of the specified file
-raw: don't print attribute names before values
-nullMarker: substitute this string for null attributes in raw mode
-plist: output attributes in XML format to file. Use - to write to stdout
option -plist is incompatible with options -raw, -nullMarker, and -name
example: mdls ~/Pictures/Birthday.jpg
example: mdls -name Keyword ~/Pictures/Birthday.jpg
Example output :
_kMDItemDisplayNameWithExtensions = "20191128_194059_Didcot_Joe_McNally_P1024114.RW2"
kMDItemAcquisitionMake = "Panasonic"
kMDItemAcquisitionModel = "DC-G9"
kMDItemBitsPerSample = 64
kMDItemColorSpace = "RGB"
kMDItemContentCreationDate = 2019-11-28 19:40:59 +0000
kMDItemContentCreationDate_Ranking = 2019-11-28 00:00:00 +0000
kMDItemContentModificationDate = 2019-11-28 19:40:59 +0000
kMDItemContentModificationDate_Ranking = 2019-11-28 00:00:00 +0000
kMDItemContentType = "com.panasonic.rw2-raw-image"
kMDItemContentTypeTree = (
"com.panasonic.rw2-raw-image",
"public.camera-raw-image",
"public.image",
"public.data",
"public.item",
"public.content"
)
kMDItemCreator = "Ver.1.2 "
kMDItemDateAdded = 2019-12-15 11:41:01 +0000
kMDItemDateAdded_Ranking = 2019-12-15 00:00:00 +0000
kMDItemDisplayName = "20191128_194059_Didcot_Joe_McNally_P1024114.RW2"
kMDItemDocumentIdentifier = 0
kMDItemEXIFVersion = "2.3.1"
kMDItemExposureMode = 0
kMDItemExposureProgram = 3
kMDItemExposureTimeSeconds = 0.06666666666666667
kMDItemFlashOnOff = 0
kMDItemFNumber = 1.4
kMDItemFocalLength = 25
kMDItemFocalLength35mm = 50
kMDItemFSContentChangeDate = 2019-12-15 11:41:01 +0000
kMDItemFSCreationDate = 2019-12-15 11:41:01 +0000
kMDItemFSCreatorCode = "ttxt"
kMDItemFSFinderFlags = 0
kMDItemFSHasCustomIcon = (null)
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSIsStationery = (null)
kMDItemFSLabel = 0
kMDItemFSName = "20191128_194059_Didcot_Joe_McNally_P1024114.RW2"
kMDItemFSNodeCount = (null)
kMDItemFSOwnerGroupID = 20
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 23960064
kMDItemFSTypeCode = "TEXT"
kMDItemHasAlphaChannel = 0
kMDItemInterestingDate_Ranking = 2019-11-28 00:00:00 +0000
kMDItemISOSpeed = 800
kMDItemKind = "Affinity Openable"
kMDItemLensModel = "LEICA DG SUMMILUX 25/F1.4 "
kMDItemLogicalSize = 23960064
kMDItemMeteringMode = 5
kMDItemOrientation = 0
kMDItemPhysicalSize = 23961600
kMDItemPixelCount = 20155392
kMDItemPixelHeight = 3888
kMDItemPixelWidth = 5184
kMDItemProfileName = "Display P3"
kMDItemRedEyeOnOff = 0
kMDItemWhiteBalance = 1
best wishes

Simon K.

Re: date and time of image files

Posted: Sun Dec 15, 2019 6:09 pm
by Klaus
Isn't macOS wonderful? :D

Re: date and time of image files

Posted: Mon Dec 16, 2019 1:26 am
by Simon Knight
Yes but I'm still mad that I'm not allowed to see colour or custom icons in the Finder side bar grrrrrr!

best wishes
Simon K.