Fix for contributed by chriszappia
@@ -41,6 +41,7 @@ import com.drew.lang.Rational;
import com.drew.metadata.Directory;
import com.drew.metadata.MetadataException;
import com.drew.metadata.Tag;
+import com.drew.metadata.exif.ExifDirectoryBase;
import com.drew.metadata.exif.ExifIFD0Directory;
import com.drew.metadata.exif.ExifReader;
import com.drew.metadata.exif.ExifSubIFDDirectory;
@@ -301,10 +302,8 @@ public class ImageMetadataExtractor {
public void handle(Directory directory, Metadata metadata)
throws MetadataException {
- //TODO: after upgrading metadataextractor, swap out
- //magic number with ExifDirectoryBase.TAG_PAGE_NUMBER
- if (directory.containsTag(297)) {
- int[] pageNums = directory.getIntArray(297);
+ if (directory.containsTag(ExifDirectoryBase.TAG_PAGE_NUMBER)) {
+ int[] pageNums = directory.getIntArray(ExifDirectoryBase.TAG_PAGE_NUMBER);
//pages can be in any order, take the max
if (pageNums != null && pageNums.length > 1) {
Integer curr = metadata.getInt(TIFF.EXIF_PAGE_COUNT);
