metadata-extractor icon indicating copy to clipboard operation
metadata-extractor copied to clipboard

Multi-Page TIFF's 2nd page tagged as 'thumbnail'

Open kuhnboy opened this issue 7 years ago • 1 comments

Multi-Page TIFF's 2nd page tagged as 'Exif Thumbnail'. Subsequent pages show 'Exif Image Directory'. Example: http://www.nightprogrammer.org/wp-uploads/2013/02/multipage_tiff_example.tif

kuhnboy avatar Jun 26 '17 15:06 kuhnboy

When extracting from that image, I get the first page tagged as 'Exif IFD0' and the following pages as 'Exif Image'. If you are still having the same issue, perhaps take a closer look at the hasFollowerIfd method in ExifTiffHandler.java

public boolean hasFollowerIfd()
    {
        // In Exif, the only known 'follower' IFD is the thumbnail one, however this may not be the case.
        // UPDATE: In multipage TIFFs, the 'follower' IFD points to the next image in the set
        if (_currentDirectory instanceof ExifIFD0Directory || _currentDirectory instanceof ExifImageDirectory) {
            // If the PageNumber tag is defined, assume this is a multipage TIFF or similar
            // TODO: Find better ways to know which follower Directory should be used
            if (_currentDirectory.containsTag(ExifDirectoryBase.TAG_PAGE_NUMBER))
                pushDirectory(ExifImageDirectory.class);
            else
                pushDirectory(ExifThumbnailDirectory.class);
            return true;
        }

        // The Canon EOS 7D (CR2) has three chained/following thumbnail IFDs
        if (_currentDirectory instanceof ExifThumbnailDirectory)
            return true;

        // This should not happen, as Exif doesn't use follower IFDs apart from that above.
        // NOTE have seen the CanonMakernoteDirectory IFD have a follower pointer, but it points to invalid data.
        return false;
    }

Currently it sets the directory to 'ExifThumbnail' if there is no page number detected in the current directory, so maybe this got changed on the image you were using for some reason?

payton avatar Jul 07 '17 16:07 payton