From f9def921178f2c1995b28900e80e2a338257729b Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Wed, 3 Aug 2022 13:00:26 +0200 Subject: refactor out EXIF rotation nonsense into its self-contained class --- .../gui/composites/configuration/SimpleConfigurationComposite.java | 6 ++---- .../java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java | 3 ++- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java index 4fb4874e..cd8544d8 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/configuration/SimpleConfigurationComposite.java @@ -21,8 +21,6 @@ import java.io.IOException; import java.util.Arrays; import java.util.Locale; -import javax.imageio.ImageIO; - import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.DND; import org.eclipse.swt.dnd.DropTarget; @@ -54,6 +52,7 @@ import org.eclipse.swt.widgets.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.Util; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.commons.Messages; import at.asit.pdfover.commons.Profile; @@ -468,8 +467,7 @@ public class SimpleConfigurationComposite extends ConfigurationCompositeBase { try { File imgFile = new File(image); this.logo = new Image(this.getDisplay(), - ImageConverter.convertToSWT(Emblem.fixImage( - ImageIO.read(imgFile), imgFile))); + ImageConverter.convertToSWT(Util.readImageWithEXIFRotation(imgFile))); } catch (IOException e) { log.error("Error reading image", e); } diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java index 18009895..92efea0a 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/utils/SignaturePlaceholderCache.java @@ -33,6 +33,7 @@ import org.eclipse.swt.graphics.ImageData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import at.asit.pdfover.Util; import at.asit.pdfover.commons.Constants; import at.asit.pdfover.signator.Emblem; import at.asit.pdfover.signer.pdfas.PdfAs4SignatureParameter; @@ -52,7 +53,7 @@ public class SignaturePlaceholderCache { } private static Image loadImage(String fileDir, String fileName, String fileExt) throws IOException { - return ImageIO.read(new File(fileDir, fileName + "." + fileExt)); + return Util.readImageWithEXIFRotation(new File(fileDir, fileName + "." + fileExt)); } /** -- cgit v1.2.3