Camera Data Exif

I need to look into a files Camera Data (Exif) I am able to work out how to get our camera model. The first question is can anybody show me the additional shell to trim the results of this:

set The_TIFF to POSIX path of (choose file of type "TIFF" without invisibles)

my Camera_Model(The_TIFF)

-- results
"/Users/marklarsen/Desktop/Resized Print/Test File.tif -------------
kMDItemAcquisitionModel = \"Canon EOS-1Ds Mark II\""

on Camera_Model(The_TIFF)
	try
		do shell script "/usr/bin/mdls -name kMDItemAcquisitionModel" & space & quoted form of The_TIFF
	on error Error_Message number Error_Number
		return false
	end try
end Camera_Model

In addition to this I would like the serial number to confirm that the image was shot in our studio. The problem I have here is in Adobe Bridge" it says Serial Number “333945” but this is what I get from a whole return. Is my number here anywhere that I can’t see (human readable)

“/usr/bin/mdls ‘/Users/marklarsen/Desktop/Resized Print/Test File.tif’”
“/Users/marklarsen/Desktop/Resized Print/Test File.tif -------------
kMDItemAcquisitionMake = "Canon"
kMDItemAcquisitionModel = "Canon EOS-1Ds Mark II"
kMDItemAperture = 8.643856
kMDItemAttributeChangeDate = 2008-04-25 17:20:28 +0100
kMDItemBitsPerSample = 24
kMDItemColorSpace = "CMYK"
kMDItemContentCreationDate = 2008-04-25 15:29:45 +0100
kMDItemContentModificationDate = 2008-04-25 15:29:46 +0100
kMDItemContentType = "public.tiff"
kMDItemContentTypeTree = ("public.tiff", "public.image", "public.data", "public.item", "public.content")
kMDItemCreator = "Adobe Photoshop CS2 Macintosh"
kMDItemDisplayName = "Test File.tif"
kMDItemEXIFVersion = "2.2.1"
kMDItemExposureMode = 1
kMDItemExposureTimeSeconds = 0.01666667
kMDItemFlashOnOff = 0
kMDItemFocalLength = 125
kMDItemFSContentChangeDate = 2008-04-25 15:29:46 +0100
kMDItemFSCreationDate = 2008-04-25 15:29:45 +0100
kMDItemFSCreatorCode = 943868237
kMDItemFSFinderFlags = 1024
kMDItemFSInvisible = 0
kMDItemFSIsExtensionHidden = 0
kMDItemFSLabel = 0
kMDItemFSName = "Test File.tif"
kMDItemFSNodeCount = 0
kMDItemFSOwnerGroupID = 0
kMDItemFSOwnerUserID = 501
kMDItemFSSize = 2985855
kMDItemFSTypeCode = 1414088262
kMDItemHasAlphaChannel = 0
kMDItemID = 979285
kMDItemISOSpeed = 100
kMDItemKind = "Adobe Photoshop TIFF file"
kMDItemLastUsedDate = 2008-04-25 17:20:28 +0100
kMDItemOrientation = 0
kMDItemPixelHeight = 1200
kMDItemPixelWidth = 1049
kMDItemProfileName = "Europe ISO Coated FOGRA27"
kMDItemRedEyeOnOff = 0
kMDItemResolutionHeightDPI = 300
kMDItemResolutionWidthDPI = 300
kMDItemUsedDates = (2008-04-25 15:29:46 +0100, 2008-04-25 01:00:00 +0100)
kMDItemWhiteBalance = 0”

Mark:

I am pretty darn sure that camera model numbers are not included in image EXIF data. You should be able to enter that (or any other info) into your camera, however, and then use kMDItemComment to extract it:

set a to choose file
set b to do shell script "mdls -name kMDItemComment " & quoted form of POSIX path of a
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\""
set c to b's text item 2
set AppleScript's text item delimiters to astid
c
-->"CRAIG A SMITH DVM                   "

In my case, I just put my name in there, and now every image that the camera generates has that as part of the metadata. The last half of the script is the primary answer to your question; how to get just the data from the do shell script.

Hope this helps,

Just one more thing. I noticed that I had a bunch of white space in my comment. Our very own Bruce Phillips put together a nice handler to take care of that. (This is the thread for that discussion.):

set a to choose file
set b to do shell script "mdls -name kMDItemComment " & quoted form of POSIX path of a
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to "\""
set c to b's text item 2
set AppleScript's text item delimiters to astid
set d to trim(c)
d

on trim(someText)
	repeat until someText does not start with " "
		set someText to text 2 thru -1 of someText
	end repeat
	
	repeat until someText does not end with " "
		set someText to text 1 thru -2 of someText
	end repeat
	
	return someText
end trim
-->"CRAIG A SMITH DVM"

Craig, Thank for the input. I will have to speak to the people in the photography dept about adding a unique identifier via the camera to the exif data (I don’t know much about the cameras involved). This would be a better solution than my checking two conditions to identify if it was one of ours. I looked into where Adobe Bridge was finding this info and its in the file headers xmpmeta rdf but not part of the camera-raw-settings or the exif. If I can get your solution to work this will help for all shots taken after this point but it looks like I will need to use grep to expose this info for shots that were taken before your tip. I also need date/time when the shot was taken so I will need to work out which of the time stamps this is. These files are sent out via FTP and clipped/cut out returned via FPT for us to use so the created and modified dates are no use to me.