Search code examples
objective-cmacoslibexif

Get exif data in mac OS development


I'm brand new to objective-C and I'm trying to get exif data on some images in my Mac OS app. It looks like I need a C library to get the exif data, so I googled around, and found some C libraries, but I'm struggling on how to implement them.

1 Do I need to get a C library in order to read exif data on an image taken from a DSLR camera? (Thing like date taken)

  1. I tried this library http://libexif.sourceforge.net/ and I dug around on the site and downloaded from here: http://www.hmug.org/pub/MacOS_X/BSD/Libraries/Graphics/libexif/, which goes to this link: http://www.hmug.org/pub/MacOS_X/BSD/Libraries/Graphics/libexif/libexif-0.6.21-1-osx8.tar.gz

  2. I drug these files into xcode, and it looks like files are added correctly to my library, I think.enter image description here

  3. I'm not sure now how to now use these C classes. I tried including the files like this

    #include "exif-data.h"

    #include "exif-loader.h"

Is this right? Should I be doing it a different way?

  1. Then I'm really confused on the usage. On the documentation page here http://libexif.sourceforge.net/api/ it says

An application using libexif would typically first create an ExifLoader to load EXIF data into memory. From there, it would extract that data as an ExifData to start manipulating it. Each IFD is represented by its own ExifContent within that ExifData, which contains all the tag data in ExifEntry form. If the MakerNote data is required, an ExifMnoteData can be extracted from the ExifData and manipulated with the MakerNote functions.

What is the syntax for "creating an ExifLoader"?

Sorry for the noob questions! Any help is appreciated.


Solution

  • This post did it: http://devmacosx.blogspot.com/2011/07/nsimage-exif-metadata.html. I can now read all the exif data that I'm looking for.