GroupDocs.Metadata for Java

Adding Metadata To TIFF In Java

Add custom metadata properties to a wide range of business documents, images, audio & video file formats using GroupDocs.Metadata for Java.

Steps for adding Metadata to TIFF in Java

GroupDocs.Metadata makes it easy for Java developers to add metadata details to TIFF files from within their applications by implementing a few easy steps.

  1. Load TIFF with an instance of Metadata class.
  2. Use Metadata.AddProperties method to add the properties.
  3. Use a predicate to find desired metadata properties.
  4. Save the changes back in TIFF format.
Copy
// load the file in an instance of Metadata class
try (Metadata metadata = new Metadata("input.tiff"))
{
    // add a property containing the content author
    int affected = metadata.addProperties(new ContainsTagSpecification(Tags.getTime().getPrinted()), 
        new PropertyValue(new Date()));

    // process operation results
    System.out.println(String.format("Affected properties: %s", affected));

    // save the file with updated metadata
    metadata.save("output.tiff");
}
<dependencies> <dependency> <groupId>com.groupdocs</groupId> <artifactId>groupdocs-metadata</artifactId> <version>24.8</version> </dependency> </dependencies> <repositories> <repository> <id>repository.groupdocs.com</id> <name>GroupDocs Repository</name> <url>https://repository.groupdocs.com/repo/</url> </repository> </repositories>
click to copy
copied
More examples Documentation

Document Metadata Management

Our comprehensive API streamlines managing document metadata. Access, edit, and manipulate various document properties for improved organization and searchability.

Metadata Functionality

Metadata Access

Effortlessly retrieve and process a document’s metadata. Gain insights into properties like author, creation date, and many others.

Metadata Editing

Modify document metadata directly. Update properties for better organization, searchability, and information accuracy.

Advanced Metadata Management

Perform complex operations on document metadata. Efficiently handle tasks like adding custom properties, deleting irrelevant data, and ensuring data consistency.

How to add custom metadata to TIFF image

This code sample demonstrates how to add a custom tag to an EXIF package

Java


try (Metadata metadata = new Metadata("input.tiff")) {
    IExif root = (IExif) metadata.getRootPackage();

    //  Set the EXIF package if it's missing
    if (root.getExifPackage() == null) {
        root.setExifPackage(new ExifPackage());
    }

    //  Add a known property
    root.getExifPackage().set(new TiffAsciiTag(TiffTagID.Artist, "Artist's name"));

    //  Add a fully custom property (which is not described in the EXIF specification)
    //  Please note that the chosen ID may intersect with the IDs used by some third party tools
    root.getExifPackage().set(new TiffAsciiTag(TiffTagID.getByRawValue(65523), "Hidden data"));

    metadata.save("output.tiff");
}

About GroupDocs.Metadata for Java API

GroupDocs.Metadata for Java is an advanced metadata fields management and manipulation solution to easily view, update, remove, find, compare, exchange and export metadata information from images and document formats without using any external software. Add metadata details to Word documents, Excel spreadsheets, PowerPoint presentations, Outlook emails, OneNote, Visio, Project, PDF, AutoCAD, ZIp, Audio and Video file formats along with the support for working with many other metadata processing features.
Learn more
About illustration

Ready to get started?

Download GroupDocs.Metadata for free or get a trial license for full access!

Adding Metadata Properties To Other File Formats

Multi format documents and images metadata addition API for Java. Retrieve metadata of some of the popular file formats as stated below.

Temporary license tips

1
Sign up with your work email.
Free mail services are not allowed.
2
Use Get a temporary license button on the second step.
 English