Skip to end of metadata
Go to start of metadata
 

The code sample in below examples uses some methods defined in Working with Common Utilities..

EXIF Metadata in Jpeg Image

Jpeg format enables a user to store a variety of EXIF information about an image. To access EXIF information of any Jpeg image follows below steps:

  1. Right-click image file.
  2. Click "Properties".
  3. Click "Details" tab.
  4. Add/update any EXIF information if required.
  5. Click "OK" to commit changes.

These steps are written for MS Windows 7.

Handling EXIF Metadata in JPEG Image Using GroupDocs.Metadata API

GroupDocs Metadata API also enables a user to access EXIF information stored in Jpeg images. Following are some basic features provided by the said API.

Getting EXIF Metadata in JPEG Image

To access EXIF Metadata in JPEG image, GroupDocs.Metadata provides JpegFormat.GetExifInfo() function which returns all EXIF metadata properties in ExifInfo object. Following are the steps to access EXIF properties:

  1. Initialize JpegFormat.
  2. Get EXIF properties in ExifInfo object using JpegFormat.GetExifInfo().
  3. Access any EXIF property using ExifInfo object i-e ExifInfo.Artist.

Following code snippet gets EXIF properties of a JPEG image and displays on the screen. 

For the video tutorial, watch Getting Exif Metadata on YouTube.

Reading Thumbnail of JPEG Format from EXIF Segment

Since version 17.12, GroupDocs.Metadata for .NET allows you to read thumbnail of JPEG format from EXIF segment. It's very useful when dealing with large images. Following code snippet shows the usage of this feature.

Updating EXIF Metadata in JPEG Image

Follow the below steps to update EXIF Metadata:

  1. Initialize JpegFormat.
  2. Get EXIF properties in ExifInfo object using JpegFormat.GetExifInfo().
  3. You can assign value to each EXIF property i-e ExifInfo.Artist="artist".
  4. Set EXIF info using JpegFormat.SetExifInfo(ExifInfo).
  5. Save image using JpegFormat.Save("output.jpeg") to commit changes.

Following code snippet updates EXIF Properties of a JPEG image.

For video tutorial, watch Updating Exif Metadata on YouTube.

From version 17.03 onwards, GroupDocs.Metadata for .NET has introduced a faster way of updating EXIF metadata in JPEG format.
Following code snippet shows how to update EXIF Properties of a JPEG image in a faster way.

Updating EXIF Data using Properties

Follow below steps to save EXIF data using properties:

  1. Initialize JpegFormat.
  2. Get EXIF properties in ExifInfo  object using JpegFormat.GetExifInfo().
  3. You can assign value to each EXIF property i-e ExifInfo.Artist="artist".
  4. Save image using JpegFormat.Save("output.jpeg") to commit changes.

Following code snippet saves EXIF data using properties:

Removing Geo-Location in EXIF Data

Very often someone may need to quickly remove private information such as a GPS location where the photo was taken. GroupDocs.Metadata API provides an easy way to get and remove EXIF GPS location. To remove Geo-location follow these steps:

  1. Initialize JpegFormat.
  2. Get GpsLocation using JpegFormat.GetGpsLocation().
  3. Remove GpsLocation using JpegFormat.RemoveGpsLocation().

Following code snippet removes Geo-location from image:

Removing EXIF Properties in JPEG Image

Removing EXIF info from a Jpeg image is as easy as removing XMP data. Following are the steps to remove EXIF info:

  1. Initialize JpegFormat.
  2. Use JpegFormat.RemoveExifInfo() to remove all EXIF info.
  3. Save image using JpegFormat.Save("output.jpeg") to commit changes.

Following code snippet removes all EXIF data of a JPEG image:

For a video tutorial, watch Removing Exif Metadata on YouTube.

From version 17.03 onwards, GroupDocs.Metadata for .NET has introduced a faster way to remove EXIF metadata from a JPEG image.
Following code snippet shows how to remove all EXIF data of a JPEG image in a faster way:


Loading and Saving EXIF Metadata with Better Speed 

This feature is supported by version 18.2 or greater.

Using GroupDocs.Metadata API, now you can load and save EXIF metadata more quickly than previous versions. Following are the steps to load and save EXIF metadata with better speed.

  1. Initialize JpegFormat
  2. Use (ExifInfo)JpegFormat.ExifValues to read EXIF metadata
  3. Set metadata property Artist by using ExifInfo.Artist = "test artist" 
  4. Save image using JpegFormat.Save("output.jpeg") to commit changes

Following code snippet loads and saves EXIF metadata with better speed.

Download Sample Image

You can download sample image used in this article.

Following is the path of sample image used in code sample:

Labels
  • No labels