利用ImageIo读取图片的元数据

- ( void)readXMPForImageWithURL:( NSURL *)url 
  CGImageSourceRef imageSourceRef = CGImageSourceCreateWithURL((__bridge CFURLRef)url, NULL);                  CGImageMetadataRef metadataRef = CGImageSourceCopyMetadataAtIndex(imageSourceRef, 0, NULL);
  if ( NULL == metadataRef) { return; } 
  NSLog( @"metadata = \n%@", metadataRef);
 }


- ( void)readXMPForImageWithData:( NSData  *)data
    CGImageSourceRef imageSourceRef =  CGImageSourceCreateWithData (( __bridge CFDataRef )data, NULL ) ;       
   CGImageMetadataRef  metadataRef =  CGImageSourceCopyMetadataAtIndex (imageSourceRef,  0 NULL );
    if ( NULL == metadataRef) {   return; } 
    NSLog( @"metadata = \n%@", metadataRef);
 }


你可能感兴趣的:(利用ImageIo读取图片的元数据)