I am looking for a 64 bit solution to read a comment from a JPEG file... Any ideas?
This does not work (it gets a dictionary containing image properties like size, but the text comment I am interested in is not there): NSURL* url = [NSURL fileURLWithPath:path]; CGImageRef imageRef = NULL; CGImageSourceRef sourceRef; sourceRef = CGImageSourceCreateWithURL((CFURLRef)url, NULL); if(sourceRef) { CFDictionaryRef testDict = CGImageSourceCopyPropertiesAtIndex(sourceRef,0,NULL); } This code DOES work, but is not 64bit compatible FSRef theFSRef; Handle dataRef; OSType dataRefType; GraphicsImportComponent theGIC; ComponentResult result; UserData theUserData; Handle theDataHandle; CFStringRef cfString = nil; if (CFURLGetFSRef ((CFURLRef) [NSURL fileURLWithPath:path], &theFSRef)) { result = QTNewDataReferenceFromFSRef (&theFSRef, 0, &dataRef, &dataRefType); if (result == noErr) { result = GetGraphicsImporterForDataRef (dataRef, dataRefType, &theGIC); if (result == noErr) { result = NewUserData (&theUserData); if (result == noErr) { result = GraphicsImportGetMetaData (theGIC, theUserData); if (result == noErr) { theDataHandle = NewHandle (0); if (theDataHandle) { result = GetUserDataText (theUserData, theDataHandle, kUserDataTextComment, 1, 0); if (result == noErr) { HLock (theDataHandle); cfString = CFStringCreateWithBytes (kCFAllocatorDefault, (UInt8 *) (*theDataHandle), GetHandleSize(theDataHandle), kCFStringEncodingMacRoman, false); HUnlock(theDataHandle); _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com