setting exif metadata with ApplicationServices framework

  • Hi all,

    Recently I have been playing with adding exif data to image files on disk.
    I found this nice blog <http://caffeinatedcocoa.com/blog/?p=7> entry which
    shows how. However, Im not able to set aperture, ISO and shutter speeds from
    my code, here (showing literal values):

      ......
        [exifDict setValue: @"800"
                    forKey:(NSString *) kCGImagePropertyExifISOSpeedRatings];

        [exifDict setValue: @"28/5"
                                            forKey: (NSString *)
    kCGImagePropertyExifApertureValue];

        [exifDict setValue:@"-1507/1140"
                    forKey: (NSString *) kCGImagePropertyExifShutterSpeedValue];

        NSMutableDictionary *metaData = [NSMutableDictionary dictionary];
        [metaData setObject: exifDict forKey:(NSString
    *)kCGImagePropertyExifDictionary];
        CGImageDestinationAddImageFromSource(destination,source,0,
    (CFDictionaryRef) metaData);
        CGImageDestinationFinalize(destination);
      .....

    However I was able to set the kCGImagePropertyTIFFMake property. Are the
    values for these properties of the wrong format ? How does one set these
    exif meta data ? Thanks.

    - Sandeep
  • Hi all,

    I think I have solved this one. I wasn't setting the right type for
    the destination properties, hence it wouldn't work. Subsequently I
    have posted an small howto on here:
    http://sandeepc.livejournal.com/656.html  Hope it helps others.

    - Sandeep

    On Fri, Feb 22, 2008 at 3:57 PM, C Sandeep <csandeep...> wrote:
    > Hi all,
    >
    > Recently I have been playing with adding exif data to image files on disk.
    > I found this nice blog entry which shows how. However, Im not able to set
    > aperture, ISO and shutter speeds from my code, here (showing literal
    > values):
    >
    > ......
    > [exifDict setValue: @"800"
    > forKey:(NSString *) kCGImagePropertyExifISOSpeedRatings];
    >
    > [exifDict setValue: @"28/5"
    > forKey: (NSString *)
    > kCGImagePropertyExifApertureValue];
    >
    > [exifDict setValue:@"-1507/1140"
    > forKey: (NSString *) kCGImagePropertyExifShutterSpeedValue];
    >
    > NSMutableDictionary *metaData = [NSMutableDictionary dictionary];
    > [metaData setObject: exifDict forKey:(NSString
    > *)kCGImagePropertyExifDictionary];
    > CGImageDestinationAddImageFromSource(destination,source,0,
    > (CFDictionaryRef) metaData);
    > CGImageDestinationFinalize(destination);
    > .....
    >
    > However I was able to set the kCGImagePropertyTIFFMake property. Are the
    > values for these properties of the wrong format ? How does one set these
    > exif meta data ? Thanks.
    >
    > - Sandeep
    >
previous month february 2008 next month
MTWTFSS
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29    
Go to today