Hi,
I am developing an iPhone app in which I want to set the keywords for an image using ImageIO.framework.
Following is the code snippet that I use for setting the keywords. But, it does not apply the keywords to image meta data. Could some one help me out in finding the problem here.
NSMutableDictionary *iptcDictionary = [NSDictionary dictionaryWithObject: [NSArray arrayWithObject: @"Test"] forKey:(NSString *)kCGImagePropertyIPTCKeywords];
NSDictionary *newImageProperties = [NSDictionary dictionaryWithObject:iptcDictionary forKey:(NSString *)kCGImagePropertyIPTCDictionary];
CGImageSourceRef imageSource=CGImageSourceCreateWithURL((CFURLRef)imageURL, nil); //imageURL is URL of source image
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData( (CFMutableDataRef)newImageFileData, CGImageSourceGetType(imageSource), 1,NULL);
CGImageDestinationAddImageFromSource(imageDestination, imageSource, 0, (CFDictionaryRef) newImageProperties);
if (CGImageDestinationFinalize(imageDestination)) [newImageFileData writeToFile:imagePath atomically:YES]; //imagePath is the path of the destination image with new metadata
Thanks and regards, Deepa