Getting photo info not in metadata.

Hi,

I have a photo that does not store the creation date in the meta data, so my question is Where could it be?

when I run


set the_file to choose file
set {metaDataNames, metaDataValues} to my get_image_info(the_file)

on get_image_info(the_file)
	tell application "Image Events"
		set the_file to open the_file
		return {name of metadata tags of the_file, value of metadata tags of the_file}
	end tell
end get_image_info

these are the results

get name of every metadata tag of image “100_0752.jpg”
{“formatOptions”, “hasAlpha”, “space”, “pixelHeight”, “typeIdentifier”, “bitsPerSample”, “path”, “make”, “dpiWidth”, “model”, “pixelWidth”, “samplesPerPixel”, “dpiHeight”, “format”}
get value of every metadata tag of image “100_0752.jpg”
{“default”, false, “RGB”, 1944.0, “public.jpeg”, 8, “/Users/josephsheehan/Desktop/100_0752.jpg”, “EASTMAN KODAK COMPANY”, 480.0, “KODAK EASYSHARE M893 IS DIGITAL CAMERA”, 2592.0, 3, 480.0, “jpeg”}

As you see there is no creation date (Date the photo was taken)

When I run


set a to choose file with prompt "Select a file for which you would like the ISO:"
set b to (do shell script "mdls " & quoted form of POSIX path of a)

The creation date comes back with the result of when the file was made, not the date the photo was taken. Since it is a copy, the date is today.

If I take the same file/photo and import it into iPhoto in the information box in iPhoto the “Date” is the date the photo was taken.

So where is this stored? and how do I access it?

Thanks!

Try this script and see if it helps:

set a to choose file

tell application "Image Events"
	close images
	set b to open (a as alias)
	set c to properties of b's metadata tag
	close b
end tell
c

If Craig’s solution doesn’t work for you then I’d suggest you try exiftool. It’s a command line program that does a nice job, and since it’s a command line tool it’s scriptable. You can find it here: http://www.sno.phy.queensu.ca/~phil/exiftool/

Exiftool is very good,

But you already have a command line tool that comes with mac os x, SIPS

set creation to paragraph 2 of (do shell script "/usr/bin/sips --getProperty creation " & quoted form of (POSIX path of (choose file))) as string

Thanks For the help!

Exiftool worked and gave me the “Create Date” and “Date/Time Original” which is what I was looking for.

Craig,
Your suggestion gave me more data but still not the two above.

Mark,
Once I found the names with Exiftool, If I asked for a single word property I get a result, but my syntax for a double word (create date) is incorrect and I have not figured that out yet. If you wouldn’t mind rewriting your script for the double word so I can learn it, I would appreciate you effort.

Thanks again all of you,

higashijoe

The sips script did get you the creation date.

But if you still want to use exiftool, Which I like and have used in the past, In most cases the double worded Tags/labels

Get condensed into one word, keeping the Capped and lower case of each word the same.
So example: Create Date, would be come CreateDate remember to add the “-” option indicator -CreateDate

In the case of Date/Time Original, do the same but get rid of the “/”.
For more help you can run exiftool in terminal with no options or file path. And you will get its man page.
It is long, so I would look at the help pages at their site.

set the_command_path to "Path/To/exiftool"
set the_dates to do shell script ((quoted form of the_command_path) & " -s -s -s  -DateTimeOriginal -CreateDate " & quoted form of (POSIX path of (choose file)))

(* 
The one -s  options give a short result with spaces as a seperater between the label and date.   
(note there are spaces between the : and 2006 , But the webpage HERE will not show them. I have <-       spaces           -> where the would normally show.)
e.g:
"DateTimeOriginal :<-       spaces           ->2006:11:23 20:09:33
CreateDate<-       spaces           -> : 2006:11:23 20:09:33"

The two -s -s  options get rid of extra spaces 
e.g:
 "DateTimeOriginal: 2006:10:06 17:45:42
CreateDate: 2006:10:06 17:45:42"


Three -s -s -s options gets rid of the labels 
e.g :

"2006:10:06 17:45:42
2006:10:06 17:45:42"
*)