• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory efficient way to get image metadata?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory efficient way to get image metadata?


  • Subject: Re: Memory efficient way to get image metadata?
  • From: email@hidden
  • Date: Mon, 3 Aug 2009 21:26:29 +0000 (UTC)


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" <email@hidden>
To: "Cocoa Developers" <email@hidden>
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, email@hidden 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 (email@hidden)

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:

This email sent to email@hidden
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Memory efficient way to get image metadata?
      • From: Dave Keck <email@hidden>
References: 
 >Re: Memory efficient way to get image metadata? (From: John Calhoun <email@hidden>)

  • Prev by Date: "unlockFocus called too many time" console message
  • Next by Date: Re: Memory efficient way to get image metadata?
  • Previous by thread: Re: Memory efficient way to get image metadata?
  • Next by thread: Re: Memory efficient way to get image metadata?
  • Index(es):
    • Date
    • Thread