Skip to end of metadata
Go to start of metadata
Contents Summary
 

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

Reading EXIF Metadata in Jpeg Image

Jpeg format enables you to store a variety of EXIF information about an image. To access EXIF information of any Jpeg image, follow the below steps.

  1. Right-click on 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 you 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 exif.getArtist()

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

Getting EXIF Data using Tag

Follow steps to get EXIF data using the tag.

  1. Initialize JpegFormat
  2. Get EXIF properties in ExifInfo  object using jpegFormat.getExifInfo()
  3. You can get EXIF properties using tag by using exifInfo.readByTagId(TiffTagIdEnum.Artist)

Following code snippet saves EXIF data using properties:

Updating EXIF Metadata in JPEG Image

Follow steps to update EXIF Metadata.

  1. Initialize JpegFormat
  2. Get EXIF properties in ExifInfo object using jpegFormat.getExifInfo()
  3. You can assign the value to each EXIF property i-e exif.setArtist("test artist")
  4. Save image using jpegFormat.save() to commit changes

Following code snippet updates EXIF Properties of a JPEG image.

GroupDocs.Metadata 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.

Removing Geo-Location in EXIF Data

Very often someone may need to quickly remove private information such 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() to commit changes

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

Loading and Saving EXIF Metadata with Better Speed 

Using GroupDocs.Metadata API, you can now 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.getExifValues to read EXIF metadata
  3. Set metadata property Artist by using ExifInfo.setArtist = "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 source code:

Labels
  • No labels