Merging TIFF pages failed, if a page contained a sub IFD without a TIFF.TAG_COMPRESSION entry

This commit is contained in:
Oliver Schmidtmer
2018-07-09 16:42:34 +02:00
parent 7cb1c6811a
commit 18800b6ee4
2 changed files with 34 additions and 5 deletions
@@ -477,12 +477,13 @@ public final class TIFFUtilities {
}
Entry compressionEntry = IFD.getEntryById(TIFF.TAG_COMPRESSION);
Number compression = (Number) compressionEntry.getValue();
if (compression.shortValue() == TIFFExtension.COMPRESSION_OLD_JPEG) {
newIFD.remove(compressionEntry);
newIFD.add(new TIFFEntry(TIFF.TAG_COMPRESSION, TIFF.TYPE_SHORT, TIFFExtension.COMPRESSION_JPEG));
if(compressionEntry != null) {
Number compression = (Number) compressionEntry.getValue();
if (compression.shortValue() == TIFFExtension.COMPRESSION_OLD_JPEG) {
newIFD.remove(compressionEntry);
newIFD.add(new TIFFEntry(TIFF.TAG_COMPRESSION, TIFF.TYPE_SHORT, TIFFExtension.COMPRESSION_JPEG));
}
}
return newIFD;
}