Working with metadata in AVIF images

AVIF (AV1 Image File Format) stores images compressed with the AV1 codec in a HEIF container. Like other modern image formats, AVIF files can carry EXIF and XMP metadata. The AvifRootPackage class implements both the IExif and IXmp interfaces.

Reading EXIF and XMP properties

  1. Load an AVIF image
  2. Get the root metadata package
  3. Read the XMP package with getXmpPackage and the EXIF package with getExifPackage. Both can be null if the image has no such metadata.

advanced_usage.managing_metadata_for_specific_formats.image.avif.AvifReadProperties

try (Metadata metadata = new Metadata(Constants.InputAvif)) {
    AvifRootPackage root = metadata.getRootPackageGeneric();

    if (root.getXmpPackage() != null && root.getXmpPackage().getSchemes().getXmpDynamicMedia() != null) {
        System.out.println(String.format("XmpDynamicMedia Artist: %s", root.getXmpPackage().getSchemes().getXmpDynamicMedia().getArtist()));
    }

    if (root.getExifPackage() != null) {
        System.out.println(String.format("ExifPackage Artist: %s", root.getExifPackage().getArtist()));
    }
}

Working with XMP metadata

For more details on reading and updating XMP metadata, please refer to the following guide: Working with XMP metadata.

Working with EXIF metadata

Please find more code samples in the Working with EXIF metadata section.

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document metadata management App

Along with full featured Java 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.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.