summaryrefslogtreecommitdiff
path: root/pdf-over-commons/src/main
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 14:41:53 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-08-08 14:41:53 +0200
commit87d9ea517e2b879da2d271c3d01f5811e49383be (patch)
treebf287b35c3cca1c5a1e82baf228c27c7d69d3eb1 /pdf-over-commons/src/main
parent64969c5e4114ef5286e73f97a09b91a300e639bd (diff)
downloadpdf-over-87d9ea517e2b879da2d271c3d01f5811e49383be.tar.gz
pdf-over-87d9ea517e2b879da2d271c3d01f5811e49383be.tar.bz2
pdf-over-87d9ea517e2b879da2d271c3d01f5811e49383be.zip
correctly handle jpeg images without EXIF orientation tag
Diffstat (limited to 'pdf-over-commons/src/main')
-rw-r--r--pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
index 4a926226..2b99ea2c 100644
--- a/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
+++ b/pdf-over-commons/src/main/java/at/asit/pdfover/commons/utils/ImageUtil.java
@@ -75,14 +75,16 @@ class EXIFRotation {
ExifIFD0Directory metaDir = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
if (metaDir == null)
return NONE;
- int orientation = metaDir.getInt(ExifDirectoryBase.TAG_ORIENTATION);
+ Integer orientation = metaDir.getInteger(ExifDirectoryBase.TAG_ORIENTATION);
+ if (orientation == null)
+ return NONE;
if (rotationForIndex.length <= orientation)
{
log.warn("Invalid orientation {} in EXIF metadata for {}", orientation, file.getName());
return NONE;
}
return rotationForIndex[orientation];
- } catch (ImageProcessingException | MetadataException e) {
+ } catch (ImageProcessingException e) {
log.error("Failed to read EXIF metadata for {}", file.getName(), e);
return NONE;
}