Partilhar via


Automatic Metadata Extraction of Digital Assets in SharePoint 2010

If you have seen the new Asset Library in SharePoint 2010 your probably as pleased as I am with the improvements in managing digital assets over SharePoint 2007.  You also may have seen how metadata encoded in the image including dimensions, date taken, author, comments and copyright fields are automatically extracted from the image into the library. SharePoint attempts to parse gif, jpeg, jpg, jpe, jfif, bmp, dib, png, tif, tiff, ico, wdp, hdp image files out of the box and extract metadata included in supported containers. 

But what about other fields that have been encoded in the image? Can SharePoint automatically extract those as well?  If so, how? Recently I tried to extract some metadata from an image for a customer created at their studio. The first thing I needed to know was what I was looking for - that is - what metadata is stored in the image? To find out I downloaded some extraction tools and found "Exiv2" to be a helpful free command-line utility. Windows Live Photo Gallery is also helpful tool in displaying asset metadata, but it is limited to specific fields (see below) 

 

Then I remembered reading somewhere that all I needed to do was to add the correct column name, and then the encoded value would show up. So when that didn’t work…..I thought that the field names might be conforming to the Exif,  XMP, or some other standard metadata container column name. What I learned was that the metadata container support for SharePoint is based on what  WIC (Windows Imaging Component) supports, including App0, App1, App13, IFD, IRB, Exif, XMP, GPS, IPTC, tEXt. You can read about WIC metadata here https://msdn.microsoft.com/en-us/library/ee719653(VS.85).aspx#supportedformats. What is needed if you would like to capture additional information is to add a column whose internal name is a WIC string. Below is a list of the column names that you can add to your asset library that will automatically be populated if your image file contains data for that field: 

  • wic_System_Copyright                                                          
  • wic_System_Rating                                                             
  • wic_System_ApplicationName                                                    
  • wic_System_DateAcquired                                                       
  • wic_System_SimpleRating                                                       
  • wic_System_GPS_Altitude                                                       
  • wic_System_GPS_AltitudeRef                                                    
  • wic_System_GPS_AreaInformation                                                
  • wic_System_GPS_Date                                                           
  • wic_System_GPS_DestBearing                                                    
  • wic_System_GPS_DestBearingRef                                                 
  • wic_System_GPS_DestDistance                                                   
  • wic_System_GPS_DestDistanceRef                                                
  • wic_System_GPS_DestLatitude                                                   
  • wic_System_GPS_DestLatitudeRef                                                
  • wic_System_GPS_DestLongitude                                                  
  • wic_System_GPS_DestLongitudeRef                                               
  • wic_System_GPS_Differential                                                   
  • wic_System_GPS_DOP                                                            
  • wic_System_GPS_ImgDirection                                                   
  • wic_System_GPS_ImgDirectionRef                                                
  • wic_System_GPS_Latitude                                                       
  • wic_System_GPS_LatitudeRef                                                    
  • wic_System_GPS_Longitude                                                      
  • wic_System_GPS_MapDatum                                                       
  • wic_System_GPS_MeasureMode                                                    
  • wic_System_GPS_ProcessingMethod                                               
  • wic_System_GPS_Satellites                                                     
  • wic_System_GPS_Speed                                                          
  • wic_System_GPS_SpeedRef                                                       
  • wic_System_GPS_Status                                                         
  • wic_System_GPS_Track                                                          
  • wic_System_GPS_TrackRef                                                       
  • wic_System_GPS_VersionID                                                      
  • wic_System_Image_ColorSpace                                                   
  • wic_System_Image_CompressedBitsPerPixel                                       
  • wic_System_Image_Compression                                                  
  • wic_System_Image_HorizontalResolution                                         
  • wic_System_Image_ImageID                                                      
  • wic_System_Image_ResolutionUnit                                               
  • wic_System_Image_VerticalResolution                                           
  • wic_System_Photo_Aperture                                                     
  • wic_System_Photo_Brightness                                                   
  • wic_System_Photo_CameraManufacturer                                           
  • wic_System_Photo_CameraModel                                                  
  • wic_System_Photo_CameraSerialNumber                                           
  • wic_System_Photo_Contrast                                                     
  • wic_System_Photo_DigitalZoom                                                  
  • wic_System_Photo_EXIFVersion                                                  
  • wic_System_Photo_ExposureBias                                                 
  • wic_System_Photo_ExposureTime                                                 
  • wic_System_Photo_Flash                                                        
  • wic_System_Photo_FlashEnergy                                                  
  • wic_System_Photo_FlashManufacturer                                            
  • wic_System_Photo_FlashModel                                                   
  • wic_System_Photo_FNumber                                                      
  • wic_System_Photo_FocalLength                                                  
  • wic_System_Photo_FocalLengthInFilm                                            
  • wic_System_Photo_ISOSpeed                                                     
  • wic_System_Photo_LensManufacturer                                             
  • wic_System_Photo_LensModel                                                    
  • wic_System_Photo_LightSource                                                  
  • wic_System_Photo_MaxAperture                                                  
  • wic_System_Photo_MeteringMode                                                 
  • wic_System_Photo_Orientation                                                  
  • wic_System_Photo_PhotometricInterpretation                                    
  • wic_System_Photo_ProgramMode                                                  
  • wic_System_Photo_RelatedSoundFile                                             
  • wic_System_Photo_Saturation                                                   
  • wic_System_Photo_Sharpness                                                    
  • wic_System_Photo_ShutterSpeed                                                 
  • wic_System_Photo_SubjectDistance                                              
  • wic_System_Photo_TranscodedForSync                                            
  • wic_System_Photo_WhiteBalance                                                 

While the WIC string is required for internal name, e.g. "wic_System_Photo_CameraModel", ideally you would give the column a pretty visible name like "Camera Model". The powershell script below is a sample of how to add column names on a SharePoint list :

function global:AddColumnToLibrary
{
 param ($webUrl=$(throw("You must specify the url for the web to add a document to")),
  $listName=$(throw("You must specify the list to add columns to")),
  $columnSystemName=$(throw("you must specify a system name to use")),
  $columnTypeName="Text",
  $columnVisibleName=$columnSystemName,
  $addToAllAssets=$true)

 $web = Get-SPWeb $webUrl
 $list = $web.Lists[$listName]
 if(-not $list.Fields.ContainsFieldWithStaticName($columnSystemName))
 {
  $trash = $list.Fields.Add($columnSystemName, [Microsoft.SharePoint.SPFieldType]::$columnTypeName, $false);
  $field = $list.Fields[$columnSystemName]
  $field.Title = $columnVisibleName
  $field.Update()
  "++ Added Field: " + $columnSystemName + "   DisplayName: " + $columnVisibleName
 }
 else
 {
  "== Library already contains: " + $columnSystemName
 }
 if($addToAllAssets)
 {
  
  $list.Views | foreach {if($_.Url.Contains("AllItems.aspx")){$view = $_}}
  if(-not $view.ViewFields.Exists($columnSystemName))
  {
   $view.ViewFields.Add($columnSystemName)
   $view.Update()
  }
 }
}

If more is needed we have a pluggable architecture so that you can always add a custom parser, but as you can see you get quite a bit out of the box. I hope this post was helpful and perhaps gave you some additional information that you didn't know about the metadata fields that were supported. Special thanks to Neil Joyer in the content management group for the information contained in this post.

Comments

  • Anonymous
    June 08, 2011
    This is awesome

  • Anonymous
    July 06, 2014
    The comment has been removed

  • Anonymous
    August 26, 2014
    Thanks a lot. The fields that give you the X,Y coordinates from the EXIF data of a digital picture I found are: wic_System_GPS_Latitude wic_System_GPS_Longitude