mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-23 07:01:39 +00:00
On OS X, read Exif tags using Cocoa's built-in functionality
This allows for RAW files Exif reading. Fixes #234.
This commit is contained in:
@@ -30,4 +30,5 @@
|
||||
- (void)destroyPool;
|
||||
- (void)reportCrash:(NSString *)crashReport;
|
||||
- (void)log:(NSString *)s;
|
||||
- (NSDictionary *)readExifData:(NSString *)imagePath;
|
||||
@end
|
||||
@@ -157,4 +157,20 @@
|
||||
{
|
||||
NSLog(@"%@", s);
|
||||
}
|
||||
|
||||
- (NSDictionary *)readExifData:(NSString *)imagePath
|
||||
{
|
||||
NSDictionary *result = nil;
|
||||
NSURL* url = [NSURL fileURLWithPath:imagePath];
|
||||
CGImageSourceRef source = CGImageSourceCreateWithURL((CFURLRef)url, nil);
|
||||
if (source != nil) {
|
||||
CFDictionaryRef metadataRef = CGImageSourceCopyPropertiesAtIndex (source, 0, nil);
|
||||
if (metadataRef != nil) {
|
||||
result = [NSDictionary dictionaryWithDictionary:(NSDictionary *)metadataRef];
|
||||
CFRelease(metadataRef);
|
||||
}
|
||||
CFRelease(source);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@end
|
||||
Reference in New Issue
Block a user