How to access EXIF tags from a JPEG file


Some JPEG imagess contain EXIF tags, which are used to store camera or GPS information in the header. This sample code shows how one can access the EXIF information.

How to use

  1. Reference libraries: ESRI.ArcGIS.DataSourcesRaster, ESRI.ArcGIS.Geodatabase, ESRI.ArcGIS.Geometry.
  2. Call this function from your code.
[VBA]
Sub AccessEXIFTag(pRasterDataset As IRasterDataset)
    'assume that pRasterDataset is opened from a JPEG file that contains EXIF tags
    Dim pDataset As IDataset
    Dim pPropertySet As IPropertySet
    Dim names, values
    Dim index As Integer
    
    Set pDataset = pRasterDataset
    Set pPropertySet = pDataset.PropertySet
    
    pPropertySet.GetAllProperties names, values
    
    For index = 0 To UBound(values)
        Debug.Print names(index), values(index)
    Next index
    
End Sub