Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

URL and File related methods

Method

metadataFromImage:error:

Summary

Pass an alias, file, HFS path, POSIX path or NSURL for an image file, and receive back a dictionary/record of the metadata.

Signature

+ (NSDictionary *)metadataFromImage:(id)fileAliasOrPath error:(NSError *__autoreleasing *)outError

Parameters

fileAliasOrPath = alias, file, HFS path, POSIX path or NSURL for an image file

outError = missing value or reference

Result

Dictionary/record of associated metadata

Availability

Version 1.0.0

Notes

If you set outError to reference, the result will be a list of two items. If there is no error, the first item will be the result of the method and the second will be missing value. If there is an error, the first item will be missing value and the second item with be an NSError.

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set fileAliasOrPath to "~/Desktop/Test/IMG_0829.JPG"

set theResult to current application's SMSForder's metadataFromImage:fileAliasOrPath |error|:(missing value)

ASify from theResult

--> {​​​​{​​​​​​​TIFF}:{​​​​​​​​​ResolutionUnit:2, ​​​​​​​​​Software:"9.0.2", ​​​​​​​​​DateTime:"2015:10:12 15:12:55", [...]}, ​​​​​​​{Exif}:{​​​​​​​​​DateTimeOriginal:"2015:10:12 15:12:55", ​​​​​​​​​MeteringMode:5, ​​​​​​​​​[...]}, ​​​​​​​{GPS}:{​​​​​​​​​ImgDirection:129.325396825397, ​​​​​​​​​LatitudeRef:"S", ​​​​​​​​​[...]}, ​​​​​​​ProfileName:"sRGB IEC61966-2.1", ​​​​​​​DPIWidth:72.0, ​​​​​​​DPIHeight:72.0, ​​​​​​​ColorModel:"RGB", ​​​​​​​{MakerApple}:{​​​​​​​​​7:1, ​​​​​​​​​3:{​​​​​​​​​​​flags:1, ​​​​​​​​​​​[...]​​​​​}​​​

theResult as record -- 10.11 only

--> {​​​​​​​​​​​{TIFF}:{​​​​​​​​​ResolutionUnit:2, ​​​​​​​​​Software:"9.0.2", ​​​​​​​​​DateTime:"2015:10:12 15:12:55", [...]}, ​​​​​​​{Exif}:{​​​​​​​​​DateTimeOriginal:"2015:10:12 15:12:55", ​​​​​​​​​MeteringMode:5, ​​​​​​​​​[...]}, ​​​​​​​{GPS}:{​​​​​​​​​ImgDirection:129.325396825397, ​​​​​​​​​LatitudeRef:"S", ​​​​​​​​​[...]}, ​​​​​​​ProfileName:"sRGB IEC61966-2.1", ​​​​​​​DPIWidth:72.0, ​​​​​​​DPIHeight:72.0, ​​​​​​​ColorModel:"RGB", ​​​​​​​{MakerApple}:{​​​​​​​​​7:1, ​​​​​​​​​3:{​​​​​​​​​​​flags:1, ​​​​​​​​​​​[...]​​​​​}​​​

theResult as record -- 10.9 and 10.10

--> <reals will be single precision>


set fileAliasOrPath to "~/Desktop/Test/No such file"

set {theResult, theError} to current application's SMSForder's metadataFromImage:fileAliasOrPath |error|:(reference)

if theResult = missing value then error (theError's localizedDescription() as text)

--> error number -2700  Image could not be read.


Click here to open script in a script editor