Class AcquisitionDateReader

Object
AcquisitionDateReader

public class AcquisitionDateReader extends Object
Reads the image acquisition-date. from EXIF metadata, if specified in an image-file.
Author:
Owen Feehan
  • Method Details

    • readAcquisitionDate

      public static Optional<ZonedDateTime> readAcquisitionDate(Path path) throws ImageIOException
      Reads an image acquisition-date from a file identified by path, based on the present of EXIF data.

      Only files with extensions matching JPEG or TIFF are checked.

      Three different EXIF tags are tried in a particular order, and the first existing tag is treated as the acqusition date:

      1. ExifDirectoryBase.TAG_DATETIME
      2. ExifDirectoryBase.TAG_DATETIME_ORIGINAL
      3. ExifDirectoryBase.TAG_DATETIME_DIGITIZED
      Parameters:
      path - the path to the image.
      Returns:
      the acquisition date, if it exists.
      Throws:
      ImageIOException - if the metadata is errored (but not if metadata is absent).
    • readAcquisitionDate

      public static Optional<ZonedDateTime> readAcquisitionDate(com.drew.metadata.Metadata metadata)
      Reads an image acquisition-date from metadata, based on the present of EXIF data.

      The same procedure is used as in readAcquisitionDate(Path).

      Parameters:
      metadata - the metadata.
      Returns:
      the acquisition date, if it exists.