Thanks John.
I looked at the documentation but there doesn't seem to be any obvious way to get the info. The only CGImageSourceCreateWithURL creation constants are: CFStringRef kCGImageSourceTypeIdentifierHint ; CFStringRef kCGImageSourceShouldAllowFloat ; CFStringRef kCGImageSourceShouldCache ; CFStringRef kCGImageSourceCreateThumbnailFromImageIfAbsent ; CFStringRef kCGImageSourceCreateThumbnailFromImageAlways ; CFStringRef kCGImageSourceThumbnailMaxPixelSize ; CFStringRef kCGImageSourceCreateThumbnailWithTransform Nothing there I need to do. And the CGImageSourceCopyProperties function only returns a single key " FileSize". Here's what I came up with. What else do I nee to add to not load the file but only read the metadata? NSURL *url = [ NSURL fileURLWithPath : inPath]; CGImageSourceRef img = CGImageSourceCreateWithURL (( CFURLRef ) url, NULL ); NSDictionary *props = ( NSDictionary *) CGImageSourceCopyProperties (img, NULL ); CFRelease (img); NSLog ( @"props: %@, path: %@" , props, inPath); P.S. I very rarely use the C interfaces, do I have to also run CFRelease on the result of the CGImageSourceCopyProperties call? ----- Original Message ----- From: "John Calhoun" <calho...@apple.com> To: "Cocoa Developers" <cocoa-dev@lists.apple.com> Sent: Monday, August 3, 2009 4:33:51 PM GMT -05:00 US/Canada Eastern Subject: Re: Memory efficient way to get image metadata? On Aug 3, 2009, at 1:23 PM, kentoz...@comcast.net wrote: > Is there some way (other than rolling my own image readers) to just > get the metadata from a file rather than having to load the entire > thing? A third party class that would be something like > "NSImageInfo" (if Apple had written such a class) Look into ImageIO on the OS. It is not a Cocoa class library but rather a C-level framework. You can get the properties from an image probably a good deal more efficiently than via NSImage. And you could easily wrap it all in your own "ImageInfo" Objective-C class if you want. John Calhoun—_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kentozier%40comcast.net This email sent to kentoz...@comcast.net _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com