Read EXIF/IPTC information from image in Cocoa

5.9k views Asked by At

I am unable to find any recent example on how to read EXIF/IPTC information from an image in Cocoa. Is there anything that can be easily done or should I use an external tool as exiftool and start it with NSTask ?

Thanks !

2

There are 2 answers

0
Adam Wright On BEST ANSWER

You can use the Image Source functions from the Image IO library. Something like...

CGImageSourceCreateWithData(someCFDataRef, nil);
CFDictionaryRef dictRef = CGImageSourceCopyPropertiesAtIndex(imgSource, 0, nil);

should fill dictRef with the EXIF data.

0
Caleb On

There's some code that appears useful here: http://devmacosx.blogspot.com/2011/07/nsimage-exif-metadata.html