HEIC stands for High-Efficiency Image Container. It is the file extension for the captured images for some of the apple devices. It is a container that can contain High-Efficiency Image Format HEIF images. In this article, we will discuss how to extract, update, and remove the EXIF and XMP metadata of the HEIF/HEIC images within Java applications.

EXIF, the Exchangeable Image File Format is the standard that defines how to store metadata properties in the most common images and audio formats. XMP is an XML-based metadata standard, that can store any set of metadata properties as name/value pairs.

The following topics are covered below

Java API for EXIF and XMP Metadata

GroupDocs.Metadata provides the metadata manipulation API for your Java applications. The API allows to read, update, add, clean/remove, and traverse features for many file formats. It supports various metadata standards like EXIF, IPTC, and XMP. Word-processing documents, spreadsheets, presentations, email messages, eBooks, images, AutoCAD drawings, audio and video files, torrents, are among the supported document formats. More precisely, you can visit the documentation for the complete list of supported file formats for metadata manipulation.

Download and Configure

Get the metadata library from the downloads section. For your Maven-based Java application, just add the following pom.xml configuration. After this, you can try the examples of this article as well the many more example available on GitHub. For the details, you may visit the API Reference.

<repository>
	<id>GroupDocsJavaAPI</id>
	<name>GroupDocs Java API</name>
	<url>http://repository.groupdocs.com/repo/</url>
</repository>
<dependency>
        <groupId>com.groupdocs</groupId>
        <artifactId>groupdocs-metadata</artifactId>
        <version>21.4</version> 
</dependency>

Read EXIF data of HEIF / HEIC Images in Java

The following are the steps to read and extract EXIF data of HEIC and HEIF images.

  • Load the HEIF or HEIC image using the Metadata class.
  • Get the root package.
  • Retrieve the EXIF package from the root package.
  • From the EXIF package, you can traverse the EXIF data properties.
  • Furthermore, you can get the IFD (Image File Directory) and GPS information from the EXIF package.

The following code shows how to get EXIF data, IFD and GPS metadata information of the HEIC image using Java.

Read XMP data of HEIC / HEIF Images in Java

The following steps read XMP metadata of HEIC or HEIF images.

  • Load the HEIF or HEIC image using the Metadata class.
  • Get the root package using the getRootPackage method.
  • From the root package, you can get the XMP basic information.
  • Further, you can get the DCMI Dublin Core information.
  • Additionally, you can get Photoshop information using the getPhotoshop method.

The following source code shows how to get XMP basic, DCMI, and Photoshop information in Java.

Likewise, there are many setter methods to set or update different XMP properties. You can even provide your own key-value pair to set the custom XMP package property.

Remove EXIF and XMP Metadata of HEIC/HEIF Images in Java

You can just set the respective EXIF package or XMP package to null to remove all the metadata properties.

The following code removes the EXIF data of HEIC images.

The following code removes the XMP data of HEIC images.

Conclusion

To sum up, we have learned to extract, update, remove EXIF and XMP metadata from the HEIF/HEIC images in Java. Furthermore, you have seen how to get IFD and GPS information from these images. Now you can easily get this information and also go ahead building your own applications like GroupDocs.Metadata App Product Family to automate metadata information.

For more information, options, and examples, you can visit the documentation and the GitHub repository. For further queries, contact us on the support forum.

See Also