Email:       Twitter: @dbrucegrant

Entries with tag <em>exif</em>.

Extracting EXIF, IPTC, XMP and more with Drew Noakes metadata-extractor-2.5.0-RC3

Nuxeo already uses an earlier version of the metadata-extractor library. Problem is, this version is somewhat dated (circa 2006/2007) and has very limited support for the broad range of embedded metadata. Well, the new 2.5.0-RC3 version looks to address this limitation by adding support for a much broader array of embedded metadata standards - including XMP! Here's a link to the metadata-extractor project. Thanks Drew!

There are enough structural changes between 2.3.0 and 2.5.0-RC3 that simply replacing the JAR will not work. In the case of Nuxeo that would have meant finding and fixing all the touch points with the metadata-extractor. I opted for a simpler option (that in no way impacts existing code).

1. Downloaded the sources to metadata-extractor-2.5.0-RC3 and the changed the package name from com.noakes.* to com.noakes.custom.* . I then recompiled to create a -RC3.1 jar.

2. Copied the -RC3.1 jar into my nxserver/lib directory (along with xmpcore.jar - comes with RC3 jar download)

3. Overrode and then modified PictureChangedListener to explicitly use -RC3.1. Then added the following code (snippet only). All of this code runs after Nuxeo has processed the blob and set what metadata it can. Obviously this can be made smarter to check to see if (as is the case for JPEGs) Nuxeo found and set the EXIF/IPTC metadata. And of course, longer term it will be best if the newer 2.5.0-RC3 is baked into Nuxeo!

                ImagingService service;
                Map<String, Object> map;
                try {
                    service = Framework.getService(ImagingService.class);
                    BufferedInputStream in = new BufferedInputStream(blob.getStream());
                    Metadata metadata = ImageMetadataReader.readMetadata(in, true);
                    exifDirectory1 = metadata.getDirectory(ExifIFD0Directory.class);
                    // metadata.getDirectory(ExifInteropDirectory.class);
                    exifDirectory3 = metadata.getDirectory(ExifSubIFDDirectory.class);
                    iptcDirectory = metadata.getDirectory(IptcDirectory.class);
                    // metadata.getDirectory(XmpDirectory.class);
                    if (exifDirectory1 != null) {
                        Date dateTimeOriginal = getExif1Date(exifDirectory1.TAG_DATETIME);
                        int width = getExif1Int(exifDirectory1.TAG_X_RESOLUTION);

The getExif1xxx functions do the necessary checking to make sure that tag exists and conversion to proper type. For example...

              private int getExif1Int(int tag) {
                  int result;

                  if (exifDirectory1.containsTag(tag)) {
                       try {
                          result = exifDirectory1.getInt(tag);
                       } catch (MetadataException e) {
                          result = 0;
                   } else {
                       result = 0;

                 return result;

Showing 1 result.

Recent Entries Recent Entries

RSS (Opens New Window)
Showing 1 - 5 of 15 results.
of 3