According to the specification, EXIF (Exchangeable image file format) is a standard that specifies the formats to be used for images, sound and tags in digital still cameras and in other systems handling the image and sound files recorded by digital still cameras. Despite the confusing definition and name of the format, EXIF is just a metadata standard. In fact, it simply defines a way to store metadata properties in a variety of well-known image and audio formats. The EXIF tag structure is borrowed from TIFF files. The specification declares a set of tags intended to store technical details such as the geolocation of the place where a picture was taken, the name of the camera owner, camera settings, etc.
Note
Please refer to the following article to get more information on the standard.
Reading basic EXIF properties
To access EXIF metadata in a file of any supported format, GroupDocs.Metadata provides the IExif.ExifPackage property. The following are the steps to read EXIF metadata:
In some cases, it’s necessary to read all EXIF properties from a file, including custom ones. To achieve this the GroupDocs.Metadata API provides direct access to the EXIF tags extracted from a file.
The GroupDocs.Metadata API facilitates the user to update EXIF metadata in a convenient way - using the ExifPackage class properties. Follow the below steps to update EXIF metadata in a file of any supported format.
using(Metadatametadata=newMetadata(Constants.InputJpeg)){IExifroot=metadata.GetRootPackage()asIExif;if(root!=null){// Set the EXIF package if it's missingif(root.ExifPackage==null){root.ExifPackage=newExifPackage();}root.ExifPackage.Copyright="Copyright (C) 2011-2019 GroupDocs. All Rights Reserved.";root.ExifPackage.ImageDescription="test image";root.ExifPackage.Software="GroupDocs.Metadata";// ...root.ExifPackage.ExifIfdPackage.BodySerialNumber="test";root.ExifPackage.ExifIfdPackage.CameraOwnerName="GroupDocs";root.ExifPackage.ExifIfdPackage.UserComment="test comment";// ...metadata.Save(Constants.OutputJpeg);}}
Adding or updating custom EXIF tags
The GroupDocs.Metadata API allows adding or updating custom tags in an EXIF package.
using(Metadatametadata=newMetadata(Constants.TiffWithExif)){IExifroot=metadata.GetRootPackage()asIExif;if(root!=null){// Set the EXIF package if it's missingif(root.ExifPackage==null){root.ExifPackage=newExifPackage();}// Add a known propertyroot.ExifPackage.Set(newTiffAsciiTag(TiffTagID.Artist,"test artist"));// Add a fully custom property (which is not described in the EXIF specification).// Please note that the chosen ID may intersect with the IDs used by some third party tools.root.ExifPackage.Set(newTiffAsciiTag((TiffTagID)65523,"custom"));metadata.Save(Constants.OutputTiff);}}
Here is a full list of tags that can be added to an EXIF package:
To remove the EXIF package from a file just assign null to the IExif.ExifPackage property. The code sample below shows how to remove EXIF metadata from a file.
Along with full featured .NET library we provide simple, but powerful free Apps.
You are welcome to view and edit metadata of PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, emails, images and more with our free online Free Online Document Metadata Viewing and Editing App.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.