objective c - Get exif data in mac OS development -
i'm brand new objective-c , i'm trying exif data on images in mac os app. looks need c library exif data, googled around, , found c libraries, i'm struggling on how implement them.
1 need c library in order read exif data on image taken dslr camera? (thing date taken)
i tried library http://libexif.sourceforge.net/ , dug around on site , downloaded here: http://www.hmug.org/pub/macos_x/bsd/libraries/graphics/libexif/, goes link: http://www.hmug.org/pub/macos_x/bsd/libraries/graphics/libexif/libexif-0.6.21-1-osx8.tar.gz
i drug these files xcode, , looks files added correctly library, think.
i'm not sure how use these c classes. tried including files this
#include "exif-data.h"
#include "exif-loader.h"
is right? should doing different way?
- then i'm confused on usage. on documentation page here http://libexif.sourceforge.net/api/ says
an application using libexif typically first create exifloader load exif data memory. there, extract data exifdata start manipulating it. each ifd represented own exifcontent within exifdata, contains tag data in exifentry form. if makernote data required, exifmnotedata can extracted exifdata , manipulated makernote functions.
what syntax "creating exifloader"?
sorry noob questions! appreciated.
you can use apples own api image exif.
here cgimagesource reference , cgimageproperties
her quick example:
nsurl *imagefileurl = [nsurl fileurlwithpath:@"/users/username/documents/tasting_menu_004.jpg"]; cgimagesourceref imagesource = cgimagesourcecreatewithurl((cfurlref)imagefileurl, null); nsdictionary *treedict; nsmutablestring *exifdata; nsdictionary *options = [nsdictionary dictionarywithobjectsandkeys: [nsnumber numberwithbool:no], (nsstring *)kcgimagesourceshouldcache, nil]; cfdictionaryref imageproperties = cgimagesourcecopypropertiesatindex(imagesource, 0, ( cfdictionaryref)options); cfrelease(imagesource); if (imageproperties) { treedict = [nsdictionary dictionarywithdictionary:(nsdictionary*)(imageproperties)]; id exiftree = [treedict objectforkey:@"{exif}"]; exifdata = [nsmutablestring stringwithstring:@""]; (nsstring *key in [[exiftree allkeys] sortedarrayusingselector:@selector(compare:)]) { nsstring* lockey = [[nsbundle bundlewithidentifier:@"com.apple.imageio.framework"] localizedstringforkey:key value:key table: @"cgimagesource"]; id value = [exiftree valueforkey:key] ; [exifdata appendformat:@"key =%@ ; value = %@ \n", lockey,value]; } nslog(@" exifdata %@", exifdata);
log -->exifdata
key =aperture value ; value = 4.643856
key =color space ; value = 65535
key =custom rendered ; value = 0
key =date time digitized ; value = 2013:06:13 08:35:07
key =date time original ; value = 2013:06:13 08:35:07
key =exif version ; value = ( 2, 2, 1 )
key =exposure bias value ; value = 0
key =exposure mode ; value = 1
key =exposure program ; value = 1
key =exposure time ; value = 0.0125
key =fnumber ; value = 5
key =flash ; value = 9
key =focal length ; value = 17
key =focal plane resolution unit ; value = 2
key =focal plane x resolution ; value = 3849.211788896504
key =focal plane y resolution ; value = 3908.141962421712
key =iso speed ratings ; value = ( 800 )
key =max aperture value ; value = 4
key =metering mode ; value = 5
key =pixel x dimension ; value = 5181
key =pixel y dimension ; value = 3454
key =scene capture type ; value = 0
key =shutter speed value ; value = 6.321928
key =subject distance ; value = 1.22
key =sub-second time digitized ; value = 25
key =sub-second time original ; value = 25
key =white balance ; value = 0
Comments
Post a Comment