Working with metadata in AVIF images
Leave feedback
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.
- Load an AVIF image
- Get the root metadata package
- Read the XMP package with getXmpPackage and the EXIF package with getExifPackage. Both can be
nullif the image has no such metadata.
advanced_usage.managing_metadata_for_specific_formats.
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()));
}
}
For more details on reading and updating XMP metadata, please refer to the following guide: Working with XMP metadata.
Please find more code samples in the Working with EXIF metadata section.
You may easily run the code above and see the feature in action in our GitHub examples:
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.
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.