How read image file metadata?

I want to read metadata of image files such as copyright, author etc.

I did a web search and the closest thing is CGImageSourceCopyPropertiesAtIndex:

- (void)tableViewSelectionDidChange:(NSNotification *)notif {
 
NSDictionary* metadata = [[NSDictionary alloc] init];
 
//get selected item
NSString* rowData = [fileList objectAtIndex:[tblFileList selectedRow]];
 
//set path to file selected
NSString* filePath = [NSString stringWithFormat:@"%@/%@", objPath, rowData];
 
//declare a file manager
NSFileManager* fileManager = [[NSFileManager alloc] init];
 
//check to see if the file exists
if ([fileManager fileExistsAtPath:filePath] == YES) {
 
    //escape all the garbage in the string
    NSString *percentEscapedString = (NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (CFStringRef)filePath, NULL, NULL, kCFStringEncodingUTF8);
 
    //convert path to NSURL
    NSURL* filePathURL = [[NSURL alloc] initFileURLWithPath:percentEscapedString];
 
    NSError* error;
    NSLog(@"%@", [filePathURL checkResourceIsReachableAndReturnError:error]);
        //declare a cg source reference
        CGImageSourceRef  sourceRef;
 
        //set the cg source references to the image by passign its url path
        sourceRef = CGImageSourceCreateWithURL((CFURLRef)filePathURL, NULL);
 
        //set a dictionary with the image metadata from the source reference
        metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(sourceRef,0,NULL);
 
        NSLog(@"%@", metadata);
 
        [filePathURL release];
 
 
} else {
 
    [self showAlert:@"I cannot find this file."];
}
 
[fileManager release];
 
}

Is there any better or easy approach than this?

After some digging, it seems the command line tool mdls does similar job:

mdls IMG_0245.jpeg
_kMDItemDisplayNameWithExtensions      = "IMG_0245.jpeg"
kMDItemAcquisitionMake                 = "Apple"
...
kMDItemContentType                     = "public.jpeg"
...

But I prefer achieving these information by coding. Any ideas?

How read image file metadata?
 
 
Q