Extract creator data from IPTC

Discussion in 'Mac Programming' started by lopoz, Mar 31, 2010.

  1. lopoz macrumors regular

    Joined:
    May 10, 2005
    #1
    Hello,

    I'm trying to extract specific creator data from the IPTC of an image, but not having a lot of luck..

    I'm talking about the objects for the following keys:
    kCGImagePropertyIPTCContactInfoAddress
    kCGImagePropertyIPTCContactInfoCity
    kCGImagePropertyIPTCProvinceState
    kCGImagePropertyIPTCContactInfoPostalCode
    etc. (basically the Creator Contact info from the IPTC)

    This is my code:
    Code:
    CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef) url, NULL);
    NSDictionary *metadata = (NSDictionary *)CGImageSourceCopyPropertiesAtIndex(source, 0, NULL);
    
    [[metadata objectForKey:(id)kCGImagePropertyIPTCDictionary] objectForKey:(id)kCGImagePropertyIPTCContactInfoAddress]
    etc..
    Unfortunately, this doesn't seem to work. When compiling, I get this error message:
    Code:
      "_kCGImagePropertyIPTCContactInfoAddress", referenced from:
    -[AppController getMetadata:] in AppController.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    All other EXIF and IPTC data is fine..

    Any help?

    Thanks in advance!
     
  2. lopoz thread starter macrumors regular

    Joined:
    May 10, 2005
    #2
    Okay, so I found out from the ImageIO header in the 10.6 SDK, that kCGImagePropertyIPTCDictionary contains kCGImagePropertyIPTCCreatorContactInfo and THAT contains these possible keys

    Code:
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoCity  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoCountry  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoAddress  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoPostalCode  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoStateProvince  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoEmails  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoPhones  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    CG_EXTERN const CFStringRef kCGImagePropertyIPTCContactInfoWebURLs  __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_NA);
    So now I'm trying to access them by calling e.g.:
    Code:
    [[[metadata objectForKey:(id)kCGImagePropertyIPTCDictionary] objectForKey:(id)kCGImagePropertyIPTCCreatorContactInfo] objectForKey:(id)kCGImagePropertyIPTCContactInfoCity]
    But I'm presented with the same error.. And yes, I changed my base SDK to 10.6, since these keys are new in SL.

    Any ideas?
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #3
    Have you included the ImageIO framework in your project? I don't think it's included as standard which would explain the linker errors...
     
  4. lopoz thread starter macrumors regular

    Joined:
    May 10, 2005
    #4
    Yes, I've linked the ApplicationServices.framework which includes the ImageIO framework (and imported the header file).
     

Share This Page