• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
GraphicsImportGetMetaData and 64bit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GraphicsImportGetMetaData and 64bit


  • Subject: GraphicsImportGetMetaData and 64bit
  • From: Trygve Inda <email@hidden>
  • Date: Sun, 27 Feb 2011 04:31:40 +0000
  • Thread-topic: GraphicsImportGetMetaData and 64bit

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 (email@hidden)

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:

This email sent to email@hidden

  • Prev by Date: Re: iPad widget question
  • Next by Date: Help with simple NSView animation...
  • Previous by thread: Re: iPad widget question
  • Next by thread: Help with simple NSView animation...
  • Index(es):
    • Date
    • Thread