Search in sources :

Example 1 with XmpDirectory

use of com.drew.metadata.xmp.XmpDirectory in project drill by apache.

the class ImageBatchReader method processExtenalMetadata.

private void processExtenalMetadata() {
    boolean skipEPSPreview = false;
    for (Directory directory : metadata.getDirectories()) {
        // Skip the `Generic Metadata Directory`
        String dictName = ImageMetadataUtils.formatName(directory.getName());
        if (directory instanceof GenericMetadataDirectory) {
            continue;
        }
        if (directory instanceof ExifIFD0Directory && skipEPSPreview) {
            skipEPSPreview = false;
            continue;
        }
        if (directory instanceof EpsDirectory) {
            // If an EPS file contains a TIFF preview, skip the next IFD0
            skipEPSPreview = directory.containsTag(EpsDirectory.TAG_TIFF_PREVIEW_SIZE);
        }
        // Process the `External Metadata Directory`
        MapColumnDefn columnDefn = new MapColumnDefn(dictName).builder(loader);
        ImageDirectoryProcessor.processDirectory(columnDefn, directory, metadata, config);
        // Continue to process XmpDirectory if exists
        if (directory instanceof XmpDirectory) {
            ImageDirectoryProcessor.processXmpDirectory(columnDefn, (XmpDirectory) directory);
        }
    }
}
Also used : XmpDirectory(com.drew.metadata.xmp.XmpDirectory) ExifIFD0Directory(com.drew.metadata.exif.ExifIFD0Directory) EpsDirectory(com.drew.metadata.eps.EpsDirectory) EpsDirectory(com.drew.metadata.eps.EpsDirectory) Directory(com.drew.metadata.Directory) ExifIFD0Directory(com.drew.metadata.exif.ExifIFD0Directory) XmpDirectory(com.drew.metadata.xmp.XmpDirectory)

Aggregations

Directory (com.drew.metadata.Directory)1 EpsDirectory (com.drew.metadata.eps.EpsDirectory)1 ExifIFD0Directory (com.drew.metadata.exif.ExifIFD0Directory)1 XmpDirectory (com.drew.metadata.xmp.XmpDirectory)1