I'm looking for an example using the new APIs in 10.8 called (CGImageMetadataRef) that allow fast lookup of image metadata.
It's something along these lines, but I'm too new with the APIs to know where I'm going wrong.
CGImageSourceRef source = CGImageSourceCreateWithDataProvider(provider, NULL);
CGImageMetadataRef mr = CGImageSourceCopyMetadataAtIndex(source, 0, NULL);
Once you have a valid CGImageMetadataRef, you can use, for example, CGImageMetadataCopyTags to get an array of the metadata tags:
CGImageSourceRef source = ...
NSArray *metadataArray = nil;
if (source) {
CGImageMetadataRef metadata = CGImageSourceCopyMetadataAtIndex(source, 0, NULL);
if (metadata) {
metadataArray = CFBridgingRelease(CGImageMetadataCopyTags(metadata));
CFRelease(metadata);
}
CFRelease(source);
}
return metadataArray;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With